diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/truncate_html/html_string.rb b/lib/truncate_html/html_string.rb index abc1234..def5678 100644 --- a/lib/truncate_html/html_string.rb +++ b/lib/truncate_html/html_string.rb @@ -8,7 +8,12 @@ end def html_tokens - scan(/(?:<script.*>.*<\/script>)+|<\/?[^>]+>|[[[:alpha:]]\w\|`~!@#\$%^&*\(\)\-_\+=\[\]{}:;'",\.\/?]+|\s+/).map do + regex = if RUBY_VERSION >= "1.9" + /(?:<script.*>.*<\/script>)+|<\/?[^>]+>|[[[:alpha:]]\w\|`~!@#\$%^&*\(\)\-_\+=\[\]{}:;'",\.\/?]+|\s+/ + else + /(?:<script.*>.*<\/script>)+|<\/?[^>]+>|[\w\|`~!@#\$%^&*\(\)\-_\+=\[\]{}:;'",\.\/?]+|\s+/u + end + scan(regex).map do |token| token.gsub( #remove newline characters /\n/,''
Support ruby 1.8 as well
diff --git a/lib/ok_computer/built_in_checks/resque_failure_threshold_check.rb b/lib/ok_computer/built_in_checks/resque_failure_threshold_check.rb index abc1234..def5678 100644 --- a/lib/ok_computer/built_in_checks/resque_failure_threshold_check.rb +++ b/lib/ok_computer/built_in_checks/resque_failure_threshold_check.rb @@ -0,0 +1,19 @@+module OkComputer + class ResqueFailureThresholdCheck < SizeThresholdCheck + attr_accessor :threshold + + # Public: Initialize a check for a backed-up Resque queue + # + # threshold - An Integer to compare the queue's count against to consider + # it backed up + def initialize(threshold) + self.threshold = Integer(threshold) + self.name = "Resque Failed Jobs" + end + + # Public: The number of jobs in the check's queue + def size + Resque::Failure.count + end + end +end
Add resque failure threshold check
diff --git a/gdata.gemspec b/gdata.gemspec index abc1234..def5678 100644 --- a/gdata.gemspec +++ b/gdata.gemspec @@ -17,11 +17,11 @@ s.rubyforge_project = 'gdata-ruby-util' - s.files = FileList.new('[A-Z]*', 'lib/**/*.rb', 'config/**/*', 'test/**/*') do |fl| - fl.exclude(/test_config\.yml$/) - end - s.test_files = FileList['test/ts_gdata.rb'] - s.require_paths = ['lib'] + s.files = `git ls-files`.split("\n").reject {|f| ['test/test_config\.yml'].include?(f) } + s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + #s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } + + s.require_paths = ['lib'] s.has_rdoc = true s.extra_rdoc_files = ['README', 'LICENSE']
Use git to list the files that go in the gem
diff --git a/Casks/gimp.rb b/Casks/gimp.rb index abc1234..def5678 100644 --- a/Casks/gimp.rb +++ b/Casks/gimp.rb @@ -3,8 +3,14 @@ sha256 'a90fe7001ee4f64d5108cd7b6aad843772aab7f1a7e67018564c620a4374460a' url "http://download.gimp.org/pub/gimp/v2.8/osx/gimp-#{version}.dmg" + name 'GIMP' homepage 'http://www.gimp.org' - license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder + license :gpl + + zap :delete => [ + '~/Library/Application Support/GIMP', + '~/Library/Saved Application State/org.gnome.gimp.savedState' + ] app 'GIMP.app' end
Add name, license and zap for GIMP.app
diff --git a/Casks/docker-compose.rb b/Casks/docker-compose.rb index abc1234..def5678 100644 --- a/Casks/docker-compose.rb +++ b/Casks/docker-compose.rb @@ -1,6 +1,6 @@ cask :v1_1 => 'docker-compose' do - version '1.5.0' - sha256 'e7ef90aa8081c767380a22588f329693d30a4ec658802b117c92acbe180ce5d4' + version '1.5.1' + sha256 '113c6e3f5485e3e25654c324ee075cd0c042bd9c156e7a26d4c2d14e401074e4' # github.com is the official download host per the vendor homepage url "https://github.com/docker/compose/releases/download/#{version}/docker-compose-Darwin-x86_64"
Update Docker Compose to 1.5.1
diff --git a/apps/core/admin/controllers/app_admin_controller.rb b/apps/core/admin/controllers/app_admin_controller.rb index abc1234..def5678 100644 --- a/apps/core/admin/controllers/app_admin_controller.rb +++ b/apps/core/admin/controllers/app_admin_controller.rb @@ -13,7 +13,8 @@ unless check_action(action, :login) our_app = Spider::Admin.apps[self.class.app.short_name] raise "Admin #{self.class.app.short_name} not configured" unless our_app - user_classes = our_app[:options][:users] || Spider::Admin.base_allowed_users + user_classes = our_app[:options][:users] || [] + user_classes += Spider::Admin.base_allowed_users unless user_classes.include?(@request.user.class) raise Spider::Auth::Unauthorized.new(_("User not authorized to access this application")) end
Add admin base_allowed_users to all apps
diff --git a/spec/helper.rb b/spec/helper.rb index abc1234..def5678 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -18,4 +18,6 @@ config.use_transactional_fixtures = true end -Dir[File.expand_path('../matchers/**/*.rb', __FILE__)].each { |file| require file } +['../matchers/**/*.rb', '../support/**/*.rb'].each do |path| + Dir[File.expand_path(path, __FILE__)].each { |file| require file } +end
Create support directory with shared examples
diff --git a/GDSheetController.podspec b/GDSheetController.podspec index abc1234..def5678 100644 --- a/GDSheetController.podspec +++ b/GDSheetController.podspec @@ -0,0 +1,21 @@+Pod::Spec.new do |s| + s.name = "GDSheetController" + s.version = "0.1.1" + + s.summary = "Simply organize your controllers in a stack of sheets inspired by Evernote Food 2.0 app." + s.description = <<-DESC + A controller to organize multiple controllers or navigation controllers + in a stack of sheets inspired by __*Evernote Food 2.0*__ app. + DESC + s.homepage = "https://github.com/iGranDav/GDSheetController" + s.license = { :type => 'MIT', :file => 'LICENSE' } + s.authors = { 'David Bonnet' => 'david.bonnet85+github@gmail.com'} + + s.source = { :git => "https://github.com/iGranDav/GDSheetController.git", :tag => "0.1.1" } + s.source_files = "GDSheetController" + s.public_header_files = "GDSheetController/*.h" + s.frameworks = 'QuartzCore', 'CoreGraphics' + + s.requires_arc = true + s.platform = :ios, '6.0' +end
Add podspec to link directly on this repo with Cocoapods
diff --git a/spring.gemspec b/spring.gemspec index abc1234..def5678 100644 --- a/spring.gemspec +++ b/spring.gemspec @@ -19,7 +19,7 @@ gem.add_development_dependency 'bump' gem.add_development_dependency 'activesupport' - s.metadata = { + gem.metadata = { "rubygems_mfa_required" => "true", } end
Fix variable name in gemspec
diff --git a/sidekiq-pool.gemspec b/sidekiq-pool.gemspec index abc1234..def5678 100644 --- a/sidekiq-pool.gemspec +++ b/sidekiq-pool.gemspec @@ -18,7 +18,7 @@ spec.executables = ['sidekiq-pool'] spec.require_paths = ['lib'] - spec.add_dependency 'sidekiq', '>= 4.0', '< 6.0' + spec.add_dependency 'sidekiq', '>= 3.0', '< 6.0' spec.add_development_dependency 'bundler', '~> 1.11' spec.add_development_dependency 'rake', '~> 10.0'
Allow using sidekiq pool with sidekiq 3
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,7 +3,9 @@ protect_from_forgery before_filter :authenticate_user! before_filter :set_current_user_in_thread, :if => :user_signed_in? - before_filter :ensure_user_is_admin!, :except => [:show, :create, :index, :new] + # the user_signed_in? if here is needed becaue otherwise we require an admin user + # on the OmniAuth callback controller action, which is exceeding lethal + before_filter :ensure_user_is_admin!, :except => [:show, :create, :index, :new], :if => :user_signed_in? def ensure_user_is_admin! unless current_user.is_admin?
Stop our requiring-admins policy preventing anyone from ever logging in
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -32,7 +32,7 @@ #oauth-plugin needs this def current_user=(user) - current_user = user + @current_user = user end end
Fix up current_user to work with warden based authentication
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -13,7 +13,7 @@ @nav_items = [ { title: 'nav.start_page', style: 'page-nav-home', path: '/' }, { title: 'nav.map', style: 'page-nav-map', path: '/map' }, - { title: 'nav.faq', style: 'page-nav-faq', path: '/faq' }, + #{ title: 'nav.faq', style: 'page-nav-faq', path: '/faq' }, { title: 'nav.about', style: 'page-nav-about', path: '/about' }, ]
Disable faqs in navigation for current release.
diff --git a/app/controllers/concerns/authenticable.rb b/app/controllers/concerns/authenticable.rb index abc1234..def5678 100644 --- a/app/controllers/concerns/authenticable.rb +++ b/app/controllers/concerns/authenticable.rb @@ -13,7 +13,9 @@ end end + delegate :token_header_key, to: :class + def validate_token_header! - raise Errors::AuthenticationError, 'No token provided' unless request.headers.include? self.class.token_header_key + raise Errors::AuthenticationError, 'No token provided' unless request.headers.include? token_header_key end end
Add delegate for class method providing token header key
diff --git a/app/controllers/filter_data_controller.rb b/app/controllers/filter_data_controller.rb index abc1234..def5678 100644 --- a/app/controllers/filter_data_controller.rb +++ b/app/controllers/filter_data_controller.rb @@ -14,7 +14,8 @@ qings = qings.filter_unique # Temporary guard clause to investigate a strange flapping spec. - if (weird = qings.select { |qing| qing.full_rank.empty? }).any? + # Only running in test mode b/c full_rank call was causing N+1 performance issues + if Rails.env.test? && (weird = qings.select { |qing| qing.full_rank.empty? }).any? pp(weird) raise "qing rank should always be non-empty" end
Fix unperformant call to full_rank
diff --git a/config/initializers/kaminari_config.rb b/config/initializers/kaminari_config.rb index abc1234..def5678 100644 --- a/config/initializers/kaminari_config.rb +++ b/config/initializers/kaminari_config.rb @@ -1,6 +1,6 @@ Kaminari.configure do |config| - config.default_per_page = 9 - config.max_per_page = 13 + config.default_per_page = 81 + config.max_per_page = 81 # config.window = 4 # config.outer_window = 0 # config.left = 0
Put a lot on the page
diff --git a/test/monk_init_NAME.rb b/test/monk_init_NAME.rb index abc1234..def5678 100644 --- a/test/monk_init_NAME.rb +++ b/test/monk_init_NAME.rb @@ -23,4 +23,22 @@ out, err = monk("init #{TARGET} --skeleton http://github.com/monkrb/skeleton.git") assert out.match(/initialized.* #{TARGET}/) end + + test "create a correct rvmrc given a directory" do + monk("init #{TARGET}") + + rvmrc = File.read(File.join(TARGET, ".rvmrc")) + assert rvmrc[RUBY_VERSION] + assert rvmrc[File.basename(TARGET)] + end + + test "create a correct rvmrc given the current directory" do + FileUtils.mkdir(TARGET) + FileUtils.cd(TARGET) { monk("init .") } + + rvmrc = File.read(File.join(TARGET, ".rvmrc")) + assert rvmrc[RUBY_VERSION] + assert rvmrc[File.basename(TARGET)] + end end +
Verify that an rvmrc is created properly.
diff --git a/buffet.gemspec b/buffet.gemspec index abc1234..def5678 100644 --- a/buffet.gemspec +++ b/buffet.gemspec @@ -13,7 +13,6 @@ s.description = 'Buffet distributes RSpec test cases over multiple machines.' s.files = `git ls-files -- lib support`.split("\n") - s.test_files = `git ls-files -- spec/*`.split("\n") s.executables = ['buffet'] s.require_paths = ['lib']
Remove spec folder from gemspec We were including the specs when the gem was installed. This is not necessary, so remove them from the gemspec. Change-Id: I29791add1ee8a4e262fb3bcdfdd6c88f2b2699a4 Reviewed-on: https://gerrit.causes.com/1935 Tested-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@causes.com> Reviewed-by: Greg Hurrell <79e2475f81a6317276bf7cbb3958b20d289b78df@causes.com>
diff --git a/lib/generators/delayed_job/templates/upgrade_migration.rb b/lib/generators/delayed_job/templates/upgrade_migration.rb index abc1234..def5678 100644 --- a/lib/generators/delayed_job/templates/upgrade_migration.rb +++ b/lib/generators/delayed_job/templates/upgrade_migration.rb @@ -1,5 +1,9 @@ class AddQueueToDelayedJobs < ActiveRecord::Migration - def change + def self.up add_column :delayed_jobs, :queue, :string end + + def self.down + remove_column :delayed_jobs, :queue + end end
Use legacy migration instead of rails 3.1's change method
diff --git a/lib/generators/spree_reviews/install/install_generator.rb b/lib/generators/spree_reviews/install/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/spree_reviews/install/install_generator.rb +++ b/lib/generators/spree_reviews/install/install_generator.rb @@ -11,9 +11,9 @@ } end - def add_javascripts - append_file "vendor/assets/javascripts/spree/frontend/all.js", "//= require spree/frontend\n" - append_file "vendor/assets/javascripts/spree/backend/all.js", "//= require spree/backend\n" + def add_javascripts + append_file "vendor/assets/javascripts/spree/frontend/all.js", "//= require spree/frontend/spree_reviews\n" + append_file "vendor/assets/javascripts/spree/backend/all.js", "//= require spree/backend/spree_reviews\n" end def add_stylesheets
Write correct require line in vendor/assets/javascript files
diff --git a/test/unit/sync_test.rb b/test/unit/sync_test.rb index abc1234..def5678 100644 --- a/test/unit/sync_test.rb +++ b/test/unit/sync_test.rb @@ -7,7 +7,7 @@ should 'have many sync items via polymorphic association' do @person = Person.forge @person2 = Person.forge - @sync = Sync.create(:person => @person, :complete => true, :status => 'success') + @sync = Sync.create(:person => @person, :complete => true, :success_count => 2, :error_count => 0) @sync.sync_items.create(:syncable_type => 'Person', :syncable_id => @person2.id) @sync.sync_items.create(:syncable_type => 'Family', :syncable_id => @person2.family_id) assert_equal [@person2], @sync.people.all
Fix test on Sync model.
diff --git a/base/app/controllers/groups_controller.rb b/base/app/controllers/groups_controller.rb index abc1234..def5678 100644 --- a/base/app/controllers/groups_controller.rb +++ b/base/app/controllers/groups_controller.rb @@ -16,6 +16,10 @@ create! do |success, failure| success.html { self.current_subject = resource + + flash[:notice] += t('representation.notice', + :subject => resource.name) + redirect_to :home } end
Add identity change message on group creation
diff --git a/lib/fluent/plugin/in_gc.rb b/lib/fluent/plugin/in_gc.rb index abc1234..def5678 100644 --- a/lib/fluent/plugin/in_gc.rb +++ b/lib/fluent/plugin/in_gc.rb @@ -1,6 +1,11 @@ # encoding: UTF-8 class Fluent::GcInput < Fluent::Input Fluent::Plugin.register_input('gc', self) + + # To support log_level option implemented by Fluentd v0.10.43 + unless method_defined?(:log) + define_method("log") { $log } + end config_param :disable, :bool, :default => false config_param :interval, :time, :default => 5 @@ -37,16 +42,16 @@ @last_checked = now end rescue => e - $log.warn "#{e.class} #{e.message} #{e.backtrace.first}" + log.warn "#{e.class} #{e.message} #{e.backtrace.first}" end end end def start_gc - $log.info "gc: before #{GC.stat}" if @debug # intentionally info level + log.info "gc: before #{GC.stat}" if @debug # intentionally info level disabled = GC.enable GC.start GC.disable if disabled - $log.info "gc: after #{GC.stat}" if @debug + log.info "gc: after #{GC.stat}" if @debug end end
Support log_level of Fluentd 0.10.43
diff --git a/NBNPhotoChooser.podspec b/NBNPhotoChooser.podspec index abc1234..def5678 100644 --- a/NBNPhotoChooser.podspec +++ b/NBNPhotoChooser.podspec @@ -1,6 +1,8 @@ Pod::Spec.new do |s| s.name = "NBNPhotoChooser" s.version = "0.0.1" + s.platform = :ios + s.deployment_target = "7.0" s.summary = "NBNPhotoChooser is an example implementation of the Tumblr Photo Chooser." s.homepage = "https://github.com/nerdishbynature/#{s.name}" s.license = { :type => 'MIT', :file => 'LICENSE' }
Add only iOS to podspec
diff --git a/radius.gemspec b/radius.gemspec index abc1234..def5678 100644 --- a/radius.gemspec +++ b/radius.gemspec @@ -4,6 +4,7 @@ Gem::Specification.new do |s| s.name = %q{radius} s.version = ::Radius.version + s.licenses = ["MIT"] s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = [%q{John W. Long (me@johnwlong.com)}, %q{David Chelimsky (dchelimsky@gmail.com)}, %q{Bryce Kerley (bkerley@brycekerley.net)}]
Add licensing information to gemspec. This should make it easier for automated tools to find out what license is used.
diff --git a/test/unit/health_check/local_search_client_test.rb b/test/unit/health_check/local_search_client_test.rb index abc1234..def5678 100644 --- a/test/unit/health_check/local_search_client_test.rb +++ b/test/unit/health_check/local_search_client_test.rb @@ -0,0 +1,31 @@+require_relative "../../test_helper" +require "health_check/logging_config" +require "health_check/local_search_client" +Logging.logger.root.appenders = nil + +module HealthCheck + class LocalSearchClientTest < ShouldaUnitTestCase + def setup + @search_index = stub("search index") + @index_name = "my index" + @search_server = stub("search server") + @search_server.stubs(:index).with(@index_name).returns(@search_index) + SearchConfig.any_instance.stubs(:search_server).returns(@search_server) + end + + should "get the index from the SearchConfig by name" do + @search_server.expects(:index).with(@index_name) + LocalSearchClient.new(index: @index_name) + end + + should "perform a search using the index and extract results" do + term = "food" + result = stub("result", link: "/food") + result_set = stub("result set", results: [result]) + @search_index.expects(:search).with(term).returns(result_set) + + client = LocalSearchClient.new(index: @index_name) + assert_equal [result.link], client.search(term) + end + end +end
Add unit test for local search client
diff --git a/recipes/nis.rb b/recipes/nis.rb index abc1234..def5678 100644 --- a/recipes/nis.rb +++ b/recipes/nis.rb @@ -18,6 +18,8 @@ # unless node.sys.nis.servers.empty? + + node.default[:ohai][:disabled_plugins] << 'passwd' package 'nis'
Disable the Ohai password plugin on all NIS nodes
diff --git a/swagger_ui_engine.gemspec b/swagger_ui_engine.gemspec index abc1234..def5678 100644 --- a/swagger_ui_engine.gemspec +++ b/swagger_ui_engine.gemspec @@ -10,11 +10,17 @@ s.authors = ['ZuzannaSt'] s.email = ['zuzannast@gmail.com'] s.homepage = 'https://github.com/ZuzannaSt/swagger_ui_engine' - s.summary = 'Mount Swagger-Ui as Rails engine.' - s.description = 'Swagger API docs and web console for your rails project.' + s.summary = 'Mountable Rails engine that serves Swagger UI for your API documentation written in YAML files.' + s.description = 'Mount Swagger UI web console as Rails engine, configure it as you want and write your API documentation in simple YAML files.' s.license = 'MIT' - s.files = Dir['{app,config,db,lib}/**/*', 'MIT-LICENSE', 'Rakefile', 'README.rdoc'] + s.files = Dir[ + '{app,config,db,lib}/**/*', + 'MIT-LICENSE', + 'Rakefile', + 'README.rdoc', + 'CHANGELOG.md' + ] s.add_dependency 'rails' end
Redefine gem documentation and summary
diff --git a/lib/arel/ts_predications.rb b/lib/arel/ts_predications.rb index abc1234..def5678 100644 --- a/lib/arel/ts_predications.rb +++ b/lib/arel/ts_predications.rb @@ -2,11 +2,11 @@ module TSPredications def ts_query(expression, language=nil) - vector = Arel::Nodes::TSVector.new(self, language) - query = Arel::Nodes::TSQuery.new(expression, language) + vector = Arel::Nodes::TSVector.new(self, language: language) + query = Arel::Nodes::TSQuery.new(expression, language: language) Arel::Nodes::TSMatch.new(vector, query) end end -end+end
Update TSPredication to use keyword args
diff --git a/lib/celluloid/io/mailbox.rb b/lib/celluloid/io/mailbox.rb index abc1234..def5678 100644 --- a/lib/celluloid/io/mailbox.rb +++ b/lib/celluloid/io/mailbox.rb @@ -1,79 +1,9 @@ module Celluloid module IO # An alternative implementation of Celluloid::Mailbox using Reactor - class Mailbox < Celluloid::Mailbox - attr_reader :reactor - - def initialize(reactor = nil) - super() - # @condition won't be used in the class. - @reactor = reactor || Reactor.new - end - - # Add a message to the Mailbox - def <<(message) - @mutex.lock - begin - if message.is_a?(SystemEvent) - # Silently swallow system events sent to dead actors - return if @dead - - # SystemEvents are high priority messages so they get added to the - # head of our message queue instead of the end - @messages.unshift message - else - raise MailboxError, "dead recipient" if @dead - @messages << message - end - - current_actor = Thread.current[:celluloid_actor] - @reactor.wakeup unless current_actor && current_actor.mailbox == self - rescue IOError - raise MailboxError, "dead recipient" - ensure - @mutex.unlock rescue nil - end - nil - end - - # Receive a message from the Mailbox - def receive(timeout = nil, &block) - message = next_message(block) - - until message - if timeout - now = Time.now - wait_until ||= now + timeout - wait_interval = wait_until - now - return if wait_interval < 0 - else - wait_interval = nil - end - - @reactor.run_once(wait_interval) - message = next_message(block) - end - - message - rescue IOError - shutdown # force shutdown of the mailbox - raise MailboxShutdown, "mailbox shutdown called during receive" - end - - # Obtain the next message from the mailbox that matches the given block - def next_message(block) - @mutex.lock - begin - super(&block) - ensure - @mutex.unlock rescue nil - end - end - - # Cleanup any IO objects this Mailbox may be using - def shutdown - @reactor.shutdown - super + class Mailbox < Celluloid::EventedMailbox + def initialize + super(Reactor) end end end
Move Mailbox impl to Celluloid::EventedMailbox
diff --git a/lib/solidus_auth_devise.rb b/lib/solidus_auth_devise.rb index abc1234..def5678 100644 --- a/lib/solidus_auth_devise.rb +++ b/lib/solidus_auth_devise.rb @@ -3,3 +3,4 @@ require "spree/authentication_helpers" require "sass/rails" require "coffee_script" +require "deface"
Add an explicit require to deface Without this deface might not be loaded and will not apply its overrides.
diff --git a/lib/sslyze/xml/certinfo.rb b/lib/sslyze/xml/certinfo.rb index abc1234..def5678 100644 --- a/lib/sslyze/xml/certinfo.rb +++ b/lib/sslyze/xml/certinfo.rb @@ -42,9 +42,10 @@ # @return [VerifiedCertificateChain, nil] # def verified_certificate_chain - if (path_validation = certificate_validation.path_validations.find(&:verified_certificate_chain)) - path_validation.verified_certificate_chain - end + @verified_certificate_chain ||= if (element = @node.at_xpath('certificateValidation/pathValidation/verifiedCertificateChain')) + CertificateValidation::PathValidation::VerifiedCertificateChain.new(element) + + end end alias verified_chain verified_certificate_chain
Use XPath to find the verifiedCertificateChain element instead of lazy-initializing/searching the Ruby objects.
diff --git a/lib/tack/forked_sandbox.rb b/lib/tack/forked_sandbox.rb index abc1234..def5678 100644 --- a/lib/tack/forked_sandbox.rb +++ b/lib/tack/forked_sandbox.rb @@ -24,14 +24,10 @@ @reader.close result = block.call - Marshal.dump([:ok, result], @writer) + + @writer.write(Base64.encode64(Marshal.dump([:ok, result]))) rescue Object => error - Marshal.dump([ - :error, - #[error.class, error.message, error.backtrace] - Base64.encode64(error) - ], - @writer) + @writer.write(Base64.encode64(Marshal.dump([:error, error]))) ensure @writer.close exit! error ? 1 : 0 @@ -49,15 +45,12 @@ while !(chunk=@reader.read).empty? data << chunk end - status, result = Marshal.load(data) + status, result = Marshal.load(Base64.decode64(data)) case status when :ok return result when :error - #error_class, error_message, backtrace = result - #error = error_class.new(error_message) - #error.set_backtrace(backtrace) - error = Base64.decode64(result) + error = result raise error else raise "Unknown status #{status}"
Fix bug with how errors are passed through ForkedSandbox
diff --git a/lib/mongoid-app_settings.rb b/lib/mongoid-app_settings.rb index abc1234..def5678 100644 --- a/lib/mongoid-app_settings.rb +++ b/lib/mongoid-app_settings.rb @@ -7,6 +7,7 @@ class Record include Mongoid::Document identity type: String + store_in :settings end module ClassMethods
Store settings in settings collection
diff --git a/lib/ringleader/app_proxy.rb b/lib/ringleader/app_proxy.rb index abc1234..def5678 100644 --- a/lib/ringleader/app_proxy.rb +++ b/lib/ringleader/app_proxy.rb @@ -22,7 +22,7 @@ end def run - start_activity_timer + start_activity_timer if config.idle_timeout > 0 debug "server listening for connections for #{config.name} on port #{config.server_port}" loop { handle_connection! @server.accept } end @@ -34,7 +34,7 @@ started = @app.start if started proxy_to_app! socket - @activity_timer.reset + @activity_timer.reset if @activity_timer else error "could not start app" socket.close
Handle 0 idle_timeout for apps
diff --git a/redrax.gemspec b/redrax.gemspec index abc1234..def5678 100644 --- a/redrax.gemspec +++ b/redrax.gemspec @@ -26,4 +26,5 @@ spec.add_development_dependency "minitest" spec.add_development_dependency "minitest-vcr" spec.add_development_dependency "yard" + spec.add_development_dependency "webmock" end
Add webmock as a dev dep
diff --git a/app/controllers/ajo_register/registrations_controller.rb b/app/controllers/ajo_register/registrations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/ajo_register/registrations_controller.rb +++ b/app/controllers/ajo_register/registrations_controller.rb @@ -27,6 +27,6 @@ protected def after_sign_up_path_for(resource) - main_app.registration_thank_you_path + "http://google.com" end end
Add after sign up path
diff --git a/schlep.gemspec b/schlep.gemspec index abc1234..def5678 100644 --- a/schlep.gemspec +++ b/schlep.gemspec @@ -15,8 +15,7 @@ s.rubyforge_project = "schlep" s.files = `git ls-files`.split("\n") - s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } + s.test_files = `git ls-files -- spec/*`.split("\n") s.require_paths = ["lib"] s.add_runtime_dependency "redis"
Remove unused files from gemspec
diff --git a/core/lib/spree/testing_support/factories/shipping_method_factory.rb b/core/lib/spree/testing_support/factories/shipping_method_factory.rb index abc1234..def5678 100644 --- a/core/lib/spree/testing_support/factories/shipping_method_factory.rb +++ b/core/lib/spree/testing_support/factories/shipping_method_factory.rb @@ -16,6 +16,8 @@ name 'UPS Ground' code 'UPS_GROUND' + carrier 'UPS' + service_level '1DAYGROUND' calculator { |s| s.association(:shipping_calculator, strategy: :build, preferred_amount: s.cost) }
Add carrier and service level to the shipping method factory
diff --git a/lib/generators/invitational/install/install_generator.rb b/lib/generators/invitational/install/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/invitational/install/install_generator.rb +++ b/lib/generators/invitational/install/install_generator.rb @@ -4,10 +4,6 @@ source_root File.expand_path('../templates', __FILE__) argument :identity_class, type: :string, default: "User", banner: "Class name of identity model (e.g. User)" - - def add_to_gemfile - gem "cancan" - end def invitation_model @identity_class = identity_class.gsub(/\,/,"").camelize
Remove cancan gem from generator The gemspec already declares cancan as a dependency, so we don't need to add it to the host's Gemfile as well.
diff --git a/lib/geo_ips.rb b/lib/geo_ips.rb index abc1234..def5678 100644 --- a/lib/geo_ips.rb +++ b/lib/geo_ips.rb @@ -27,11 +27,7 @@ end def parse response - MultiJson.decode(fix_response(response)) - end - - def fix_response response_string - response_string.gsub(/,\n}$/,"\n}") + MultiJson.decode(response) end end
Remove JSON response correction Thanks @zeke!
diff --git a/spec/bundler/cli_rspec.rb b/spec/bundler/cli_rspec.rb index abc1234..def5678 100644 --- a/spec/bundler/cli_rspec.rb +++ b/spec/bundler/cli_rspec.rb @@ -6,4 +6,9 @@ bundle '--invalid_argument', :exitstatus => true expect(exitstatus).to_not be_zero end + + it 'returns non-zero exit status when passed unrecognized task' do + bundle 'unrecognized-tast', :exitstatus => true + expect(exitstatus).to_not be_zero + end end
Add spec for exitstatus for unrecognized tasks
diff --git a/spec/lib/mr_darcy_spec.rb b/spec/lib/mr_darcy_spec.rb index abc1234..def5678 100644 --- a/spec/lib/mr_darcy_spec.rb +++ b/spec/lib/mr_darcy_spec.rb @@ -5,14 +5,15 @@ it { should respond_to :driver } it { should respond_to :driver= } - describe '#promise' do - When 'no driver is specified' do - subject { MrDarcy.promise {} } + # This spec doesn't pass on CI. I can't figure out why. + # describe '#promise' do + # When 'no driver is specified' do + # subject { MrDarcy.promise {} } - it 'uses whichever driver is the default' do - expect(MrDarcy).to receive(:driver).and_return(:thread) - subject - end - end - end + # it 'uses whichever driver is the default' do + # expect(MrDarcy).to receive(:driver).and_return(:thread) + # subject + # end + # end + # end end
Disable failing spec on CI.
diff --git a/spec/models/event_spec.rb b/spec/models/event_spec.rb index abc1234..def5678 100644 --- a/spec/models/event_spec.rb +++ b/spec/models/event_spec.rb @@ -1,6 +1,23 @@ require 'spec_helper' describe Event do + + describe "mass assignment" do + + context "allowed" do + [:name, :description, :occurs_at, :picture, :url, :twitter, :user_id].each do |attr| + it { should allow_mass_assignment_of(attr) } + end + end + + context "not allowed" do + [:id, :created_at, :updated_at, :starts_votes_at, :end_votes_at, :slug, + :proposals_count, :closed_at].each do |attr| + it { should_not allow_mass_assignment_of(attr) } + end + end + end + context ".occurs_first" do it "should sort the next to occur first" do late_event = FactoryGirl.create(:event, :occurs_at => 5.days.from_now)
Add spec of mass assigment on Event
diff --git a/db/data_migration/20150323153536_remove_mp_from_mps.rb b/db/data_migration/20150323153536_remove_mp_from_mps.rb index abc1234..def5678 100644 --- a/db/data_migration/20150323153536_remove_mp_from_mps.rb +++ b/db/data_migration/20150323153536_remove_mp_from_mps.rb @@ -0,0 +1,8 @@+puts "Removing MP from MP's letters:" +Person.where('letters LIKE "%MP%"').each do |person| + new_letters = person.letters.gsub(/(^|\s)MP(\s|$)/, '') + if person.letters != new_letters + puts "\tUpdating '#{person.letters}' to '#{new_letters}' for #{person.slug}" + person.update_attribute(:letters, new_letters) + end +end
Remove MP from MP's names As a person interested in government I need to know that as of 30/03/15 MP's elected in 2010 are no longer officially MP's so that that I am not confused. As a MP I need GOV.UK to reflect the fact that I am no longer a MP so that I am not accused of impropriety.
diff --git a/db/migrate/20120306185750_acts_as_taggable_on_posts.rb b/db/migrate/20120306185750_acts_as_taggable_on_posts.rb index abc1234..def5678 100644 --- a/db/migrate/20120306185750_acts_as_taggable_on_posts.rb +++ b/db/migrate/20120306185750_acts_as_taggable_on_posts.rb @@ -14,7 +14,9 @@ t.references :taggable, :polymorphic => true t.references :tagger, :polymorphic => true - t.string :context + # Limit is created to prevent MySQL error on index + # length for MyISAM table type: http://bit.ly/vgW2Ql + t.string :context, :limit => 128 t.datetime :created_at end
Add a limit to the context column Signed-off-by: Nathan Lowrie <4f3407de78bccc8cc160ee4d278d5efe7162e6b5@finelineautomation.com>
diff --git a/Library/Homebrew/requirements/ruby_requirement.rb b/Library/Homebrew/requirements/ruby_requirement.rb index abc1234..def5678 100644 --- a/Library/Homebrew/requirements/ruby_requirement.rb +++ b/Library/Homebrew/requirements/ruby_requirement.rb @@ -9,15 +9,14 @@ end satisfy build_env: false do - which_all("ruby").detect do |ruby| - version = /\d\.\d/.match Utils.popen_read(ruby, "--version") - next unless version - Version.create(version.to_s) >= Version.create(@version) - end + found_ruby = rubies.detect { |ruby| suitable?(ruby) } + return unless found_ruby + ENV.prepend_path "PATH", found_ruby.dirname + found_ruby end def message - s = "Ruby #{@version} is required to install this formula." + s = "Ruby >= #{@version} is required to install this formula." s += super s end @@ -33,4 +32,30 @@ name end end + + private + + def rubies + rubies = which_all("ruby") + if ruby_formula.installed? + rubies.unshift Pathname.new(ruby_formula.bin/"ruby") + end + rubies.uniq + end + + def suitable?(ruby) + version = Utils.popen_read(ruby, "-e", "print RUBY_VERSION").strip + version =~ /^\d+\.\d+/ && Version.create(version) >= min_version + end + + def min_version + @min_version ||= Version.create(@version) + end + + def ruby_formula + @ruby_formula ||= Formula["ruby"] + rescue FormulaUnavailableError + nil + end + end
Prepend selected ruby to PATH in RubyRequirement
diff --git a/lib/rom/env.rb b/lib/rom/env.rb index abc1234..def5678 100644 --- a/lib/rom/env.rb +++ b/lib/rom/env.rb @@ -5,7 +5,25 @@ class Env include Equalizer.new(:repositories, :relations, :readers, :commands) - attr_reader :repositories, :relations, :readers, :commands + # @return [Hash] configured repositories + # + # @api public + attr_reader :repositories + + # @return [RelationRegistry] relation registry + # + # @api public + attr_reader :relations + + # @return [ReaderRegistry] reader registry + # + # @api public + attr_reader :readers + + # @return [Registry] command registry + # + # @api public + attr_reader :commands # @api private def initialize(repositories, relations, readers, commands)
Add more YARD docs for Env
diff --git a/SHTextFieldBlocks.podspec b/SHTextFieldBlocks.podspec index abc1234..def5678 100644 --- a/SHTextFieldBlocks.podspec +++ b/SHTextFieldBlocks.podspec @@ -7,15 +7,14 @@ s.name = name s.version = version - s.summary = "Prefixed UITextField category replacing delegate calls with blocks. Without libffi and swizzling." + s.summary = "Prefixed UITextField category replacing delegate calls with blocks. without libffi and swizzling." s.description = <<-DESC - UITextField delegate callbacks via blocks. + Delegate callbacks via blocks. Blocks are hold with a weak reference so you don't have to cleanup when your object is gone. * Swizzle and junk free * No need to clean up after - The blocks are self maintained. - * Textfields are referenced in a map with weak properties * Prefixed selectors. * Minimum clutter on top of the public interface.
Clean name a bit. Generic.
diff --git a/lib/sastrawi/morphology/disambiguator/disambiguator_prefix_rule9.rb b/lib/sastrawi/morphology/disambiguator/disambiguator_prefix_rule9.rb index abc1234..def5678 100644 --- a/lib/sastrawi/morphology/disambiguator/disambiguator_prefix_rule9.rb +++ b/lib/sastrawi/morphology/disambiguator/disambiguator_prefix_rule9.rb @@ -0,0 +1,19 @@+module Sastrawi + module Morphology + module Disambiguator + class DisambiguatorPrefixRule9 + def disambiguate(word) + contains = /^te([bcdfghjklmnpqrstvwxyz])er(([bcdfghjklmnpqrstvwxyz]).*)$/.match(word) + + if contains + matches = contains.captures + + return if matches[0] == 'r' + + return matches[0] << 'er' << matches[1] << matches[2] + end + end + end + end + end +end
Add implementation of ninth rule of disambiguator prefix
diff --git a/spec/support/helpers/query_recorder.rb b/spec/support/helpers/query_recorder.rb index abc1234..def5678 100644 --- a/spec/support/helpers/query_recorder.rb +++ b/spec/support/helpers/query_recorder.rb @@ -8,7 +8,10 @@ @log = [] @cached = [] @skip_cached = skip_cached - ActiveSupport::Notifications.subscribed(method(:callback), 'sql.active_record', &block) + # force replacement of bind parameters to give tests the ability to check for ids + ActiveRecord::Base.connection.unprepared_statement do + ActiveSupport::Notifications.subscribed(method(:callback), 'sql.active_record', &block) + end end def show_backtrace(values)
Apply bindings to querys from QueryRecorder - local tests that assume certain parameters to queries from QueryRecorder fail. These same tests don't fail in the runners, and I can't tell why. This fixes the local failures
diff --git a/spec/views/users/show.html.erb_spec.rb b/spec/views/users/show.html.erb_spec.rb index abc1234..def5678 100644 --- a/spec/views/users/show.html.erb_spec.rb +++ b/spec/views/users/show.html.erb_spec.rb @@ -0,0 +1,50 @@+require 'rails_helper' + +RSpec.describe "users/show", type: :view do + before(:each) do + @user = create(:user) + create(:plan_with_recipes, user_id: @user.id) + end + + it "renders the :show template" do + render + expect(view).to render_template(:show) + end + + it "displays the user's name as a header" do + render + expect(rendered).to include("<h1>Hello, Thomas Jefferson</h1>") + end + + it "displays a link to users/edit" do + render + expect(rendered).to include("<a href=\"/users/#{@user.id}/edit\">Edit Profile</a>") + end + + it "displays the user's information" do + render + expect(rendered).to include("<div>Name: Thomas Jefferson</div>") + expect(rendered).to include("<div>Email: tj@monticello.com</div>") + end + + it "has a link for deleting the user's account" do + render + expect(rendered).to include("<input type=\"hidden\" name=\"_method\" value=\"delete\" />") + end + + it "displays all plan objects associated with the user" do + render + expect(rendered).to include("plan-display") + end + + it "displays the plan_recipes partial" do + render + expect(rendered).to render_template(partial: "_plan_recipes", count: 1) + end + + it "has links to recipes in the dropdown" do + render + expect(rendered).to include("<a href=\"/recipes/") + end + +end
Add tests for users/show view; all tests pass
diff --git a/spec/database.rb b/spec/database.rb index abc1234..def5678 100644 --- a/spec/database.rb +++ b/spec/database.rb @@ -5,7 +5,7 @@ tmp_dir = Pathname.new(__FILE__).parent.parent.join('tmp') tmp_dir.mkpath ::ActiveRecord::Base.configurations = {'test' => {:adapter => 'sqlite3', :database => tmp_dir.join("test.db").to_s}} -::ActiveRecord::Base.establish_connection('test') +::ActiveRecord::Base.establish_connection(:test) class User < ::ActiveRecord::Base class Migration < ::ActiveRecord::Migration
Fix deprecation warning on ActiveRecord::Base.establish_connection
diff --git a/TEST2/test2.rb b/TEST2/test2.rb index abc1234..def5678 100644 --- a/TEST2/test2.rb +++ b/TEST2/test2.rb @@ -6,17 +6,23 @@ response = open('http://www2.stat.duke.edu/courses/Spring01/sta114/data/andrews.html') doc = Nokogiri::HTML(response) -# rows = [] +rows = {} months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] + doc.xpath('//table/tr').each do |tr| td1, description = tr.xpath('./td') links = td1.xpath('./a').map {|link| link['href']} #https://stackoverflow.com/questions/10215590/check-if-string-contains-any-substring-in-an-array-in-ruby + if months.any? { |month| description.content.include?(month) } - puts td1.content, links + table_name = td1.content.split(/[[:space:]]/).join + rows= {table_name => links} + p rows end end -# puts rows+# puts rows + +#spent a long time trying to figure out how to remove html entity &nbsp; correctly. I went down a long rabbit hole that gave me 3 different options and none really worked for my solution so I just removed all whitespace for now
Create ruby hash association with table_name and links
diff --git a/thinreports-rails.gemspec b/thinreports-rails.gemspec index abc1234..def5678 100644 --- a/thinreports-rails.gemspec +++ b/thinreports-rails.gemspec @@ -14,5 +14,5 @@ gem.name = "thinreports-rails" gem.require_paths = ["lib"] gem.version = ThinreportsRails::VERSION - gem.add_dependency "thinreports", '~>0.7.6' + gem.add_dependency "thinreports", '>=0.7.6' end
Change gemspec '~>0.7.6' --> '>=0.7.6'
diff --git a/tools/describe-domains.rb b/tools/describe-domains.rb index abc1234..def5678 100644 --- a/tools/describe-domains.rb +++ b/tools/describe-domains.rb @@ -0,0 +1,44 @@+#!/usr/bin/env ruby + +require 'json' +require 'aws-sdk' + +# Set these environment variables: +# * AWS_ACCESS_KEY_ID +# * AWS_SECRET_ACCESS_KEY + +module AWS + class CloudSearch + class Request < Core::Http::Request + include Core::Signature::Version4 + + def service + 'cloudsearch' + end + + def region + 'us-east-1' + end + end + end +end + +synonym_object = { "synonyms" => {"cat" => ["feline", "kitten"], "puppy" => "dog"} } + +request = AWS::CloudSearch::Request.new +request.host = "cloudsearch.us-east-1.amazonaws.com" +request.add_param 'Action', 'DescribeDomains' +request.add_param 'Version', '2011-02-01' + +credential_provider = AWS::Core::CredentialProviders::ENVProvider.new('AWS') +request.add_authorization!(credential_provider) +puts "---- Request" +p request + +handler = AWS::Core::Http::NetHttpHandler.new() +response = AWS::Core::Http::Response.new +handler.handle(request, response) +puts "---- Response" +p response +puts "-- body" +puts response.body
Add a tools to issue signed requests to AWS
diff --git a/cookbooks/PF_CIS_CentOS7_v1.1.0_level_2/recipes/default.rb b/cookbooks/PF_CIS_CentOS7_v1.1.0_level_2/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/PF_CIS_CentOS7_v1.1.0_level_2/recipes/default.rb +++ b/cookbooks/PF_CIS_CentOS7_v1.1.0_level_2/recipes/default.rb @@ -6,26 +6,8 @@ # # MIT LICENSE # - -# Depending upon the level the enviroment variable is given -# when calling vagrant up we will do certain things. -# level 0 will be non-compliant -# level 1 will be level 1 compliant (scored and demo of unscored) -# level 2 will be level 2 compliant (scored and demo of unscored) -case ENV['PF_LEVEL'] -when '0' -when '1' include_recipe "PF_CIS_CentOS7_v1.1.0::2_os_services" include_recipe "PF_CIS_CentOS7_v1.1.0::3_special_purpose_services.rb" include_recipe "PF_CIS_CentOS7_v1.1.0::4_network_config_and_firewall.rb" -when '1c' - include_recipe "PF_CIS_CentOS7_v1.1.0::2_os_services" - include_recipe "PF_CIS_CentOS7_v1.1.0::3_special_purpose_services.rb" - include_recipe "PF_CIS_CentOS7_v1.1.0::3_special_purpose_services_ns.rb" - include_recipe "PF_CIS_CentOS7_v1.1.0::4_network_config_and_firewall.rb" - include_recipe "PF_CIS_CentOS7_v1.1.0::4_network_config_and_firewall_ns.rb" -when '2' -else - Chef::Log.warn("Policy level #{ENV['PF_LEVEL']} is not supported at this time.") - return + return end
Tidy up the cookbook to use the new one level format.
diff --git a/discordrb-webhooks.gemspec b/discordrb-webhooks.gemspec index abc1234..def5678 100644 --- a/discordrb-webhooks.gemspec +++ b/discordrb-webhooks.gemspec @@ -19,5 +19,7 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ['lib'] + spec.add_dependency 'rest-client' + spec.required_ruby_version = '>= 2.1.0' end
:anchor: Add rest-client as a dependency
diff --git a/Casks/serviio.rb b/Casks/serviio.rb index abc1234..def5678 100644 --- a/Casks/serviio.rb +++ b/Casks/serviio.rb @@ -1,12 +1,11 @@ cask :v1 => 'serviio' do - version '1.4.1.2' - sha256 '132ed6ba9baf466eec5d89789cd8d50163fa5b534899f10a9232e00f711707aa' + version '1.5.1' + sha256 '65964602b8ea1ddc29dfefa1452610b84884caa996c02342cc9ba35d5a34d0f4' url "http://download.serviio.org/releases/serviio-#{version}-osx.tar.gz" name 'Serviio' homepage 'http://serviio.org/' - license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder + license :commercial - app 'Serviio.app' - app 'Serviio-Console.app' + pkg "Serviio-#{version}.pkg" end
Update Serviio to version 1.5.1
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 @@ -5,7 +5,7 @@ s.homepage = "https://github.com/yeahdongcn/UIColor-Hex-Swift" s.license = { :type => 'MIT', :file => 'LICENSE.md' } s.author = { "R0CKSTAR" => "yeahdongcn@gmail.com" } - s.platform = :ios, '7.0' + s.platform = :ios, '8.0' s.source = { :git => 'https://github.com/yeahdongcn/UIColor-Hex-Swift.git', :tag => "#{s.version}" } s.source_files = '*.swift' s.frameworks = ['UIKit']
Change platform to 8.0, since Swift support uses dynamic frameworks and is therefore only supported on iOS > 8.
diff --git a/validate_as_email.gemspec b/validate_as_email.gemspec index abc1234..def5678 100644 --- a/validate_as_email.gemspec +++ b/validate_as_email.gemspec @@ -22,4 +22,5 @@ gem.add_development_dependency 'aruba', '~> 0.4' gem.add_development_dependency 'activerecord', '~> 3' + gem.add_development_dependency 'sqlite3', '~> 1.3' end
Add sqlite3 to dev dependencies
diff --git a/spec/features/returning_all_defined_factoried_spec.rb b/spec/features/returning_all_defined_factoried_spec.rb index abc1234..def5678 100644 --- a/spec/features/returning_all_defined_factoried_spec.rb +++ b/spec/features/returning_all_defined_factoried_spec.rb @@ -10,6 +10,6 @@ it 'should return a list of available factories' do get remote_factory_girl_home_rails.home_index_path - expect(response.body).to eq('{"factories":["user"]}') + expect(response_json(response.body)['factories']).to eq(['user']) end end
Use spec helper to parse json and compare key/values
diff --git a/lib/express_templates/components/forms/express_form.rb b/lib/express_templates/components/forms/express_form.rb index abc1234..def5678 100644 --- a/lib/express_templates/components/forms/express_form.rb +++ b/lib/express_templates/components/forms/express_form.rb @@ -10,6 +10,7 @@ has_option :action, 'The form action containing the resource path or url.' has_option :on_success, 'Pass a form value indicating where to go on a successful submission.' has_option :on_failure, 'Pass a form value indicating where to go on a failed submission.' + has_option :enctype, 'The enctype attribute specifies how the form-data should be encoded when submitting it to the server.' prepends -> { div(style: 'display:none') { @@ -24,6 +25,7 @@ before_build -> { set_attribute(:id, form_id) set_attribute(:action, form_action) + set_attribute(:enctype, form_enctype) if form_enctype add_class(config[:id]) } @@ -35,6 +37,10 @@ config[:action] || (resource.try(:persisted?) ? resource_path(resource) : collection_path) end + def form_enctype + config[:enctype] + end + end end end
Add enctype option to express-form for file upload
diff --git a/db/migrate/20150401092257_create_users.rb b/db/migrate/20150401092257_create_users.rb index abc1234..def5678 100644 --- a/db/migrate/20150401092257_create_users.rb +++ b/db/migrate/20150401092257_create_users.rb @@ -1,4 +1,10 @@ class CreateUsers < ActiveRecord::Migration def change + create_table :users do |t| + t.string :user_name, null: false, unique: true, limit: 56 + t.string :password_digest + + t.timestamps null: false + end end end
Write migration code for users table
diff --git a/models/init.rb b/models/init.rb index abc1234..def5678 100644 --- a/models/init.rb +++ b/models/init.rb @@ -10,14 +10,14 @@ if ENV['VCAP_SERVICES'] require 'json' svcs = JSON.parse ENV['VCAP_SERVICES'] - postgres = svcs.detect { |k,v| k =~ /^postgres/ }.last.first - mysql = svcs.detect { |k,v| k =~ /^mysql/ }.last.first + postgres = svcs.detect { |k,v| k =~ /^postgres/ } + mysql = svcs.detect { |k,v| k =~ /^mysql/ } if postgres - creds = postgres['credentials'] + creds = postgres.last.first['credentials'] user, pass, host, name = %w(user password host name).map { |key| creds[key] } ENV['DATABASE_URL'] = "postgres://#{user}:#{pass}@#{host}/#{name}" elsif mysql - creds = postgres['credentials'] + creds = mysql.last.first['credentials'] user, pass, host, name = %w(user password host name).map { |key| creds[key] } ENV['DATABASE_URL'] = "mysql://#{user}:#{pass}@#{host}/#{name}" end
Fix database configuration for AppFog
diff --git a/lib/generators/websocket_rails/install/templates/events.rb b/lib/generators/websocket_rails/install/templates/events.rb index abc1234..def5678 100644 --- a/lib/generators/websocket_rails/install/templates/events.rb +++ b/lib/generators/websocket_rails/install/templates/events.rb @@ -1,21 +1,31 @@ WebsocketRails.setup do |config| - # Change to :debug for debugging output - config.log_level = :default + # Uncomment to override the default log level. The log level can be + # any of the standard Logger log levels. By default it will mirror the + # current Rails environment log level. + # config.log_level = :debug + + # Uncomment to change the default log file path. + # config.log_path = "#{Rails.root}/log/websocket_rails.log" + + # Set to true if you wish to log the internal websocket_rails events + # such as the keepalive `websocket_rails.ping` event. + # config.log_internal_events = false # Change to true to enable standalone server mode # Start the standalone server with rake websocket_rails:start_server - # Requires Redis + # * Requires Redis config.standalone = false # Change to true to enable channel synchronization between - # multiple server instances. Requires Redis. + # multiple server instances. + # * Requires Redis. config.synchronize = false # Uncomment and edit to point to a different redis instance. # Will not be used unless standalone or synchronization mode # is enabled. - #config.redis_options = {:host => 'localhost', :port => '6379'} + # config.redis_options = {:host => 'localhost', :port => '6379'} end WebsocketRails::EventMap.describe do
Add the updated config options to the generator.
diff --git a/twdeps.gemspec b/twdeps.gemspec index abc1234..def5678 100644 --- a/twdeps.gemspec +++ b/twdeps.gemspec @@ -21,5 +21,5 @@ gem.add_development_dependency 'activesupport', '~> 3.2' gem.add_development_dependency 'twtest', '~> 0.0.2' gem.add_development_dependency 'guard-test', '~> 0.5' - gem.add_development_dependency 'pry' + gem.add_development_dependency 'rake', '~> 0.9' end
Add rake to bundle in order to allow 'bundle exec rake' (travis ci etc.)
diff --git a/schema.gemspec b/schema.gemspec index abc1234..def5678 100644 --- a/schema.gemspec +++ b/schema.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'schema' s.summary = "Primitives for schema and structure" - s.version = '0.0.1.4' + s.version = '0.1.0.0' s.description = ' ' s.authors = ['Obsidian Software, Inc']
Package version increased from 0.0.1.4 to 0.1.0.0
diff --git a/moltin.gemspec b/moltin.gemspec index abc1234..def5678 100644 --- a/moltin.gemspec +++ b/moltin.gemspec @@ -18,7 +18,7 @@ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency "rest-client", "~> 1.8" + spec.add_dependency "rest-client", ">= 1.6", "< 2.0" spec.add_development_dependency "bundler", "~> 1.9" spec.add_development_dependency "rake", "~> 10.0"
Allow apps to use rest-client 1.6
diff --git a/process.rb b/process.rb index abc1234..def5678 100644 --- a/process.rb +++ b/process.rb @@ -10,7 +10,7 @@ type: program['family'], # group: program['category'], # type: program['family'], - depends: program['relatedItemsParents'].collect do |parent| + depends: (program['relatedItemsParents'] || []).collect do |parent| parent.gsub(/\[\[(.*)\]\]/, '\\1').strip end }
Handle missing property as empty element
diff --git a/web/routes/uploads.rb b/web/routes/uploads.rb index abc1234..def5678 100644 --- a/web/routes/uploads.rb +++ b/web/routes/uploads.rb @@ -6,11 +6,13 @@ route "uploads" do |r| r.on "presign" do r.post do + attache_host = FormalistDemo::Container.config.options.attache_host secret_key = FormalistDemo::Container.config.options.attache_secret_key uuid = SecureRandom.uuid expiration = (Time.now + 60*60*3).to_i # 3 hours from now { + url: "#{attache_host}/upload", uuid: uuid, expiration: expiration, hmac: OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new("sha1"), secret_key, "#{uuid}#{expiration}"),
Return the upload URL in the presign response
diff --git a/app/views/hyper_admin/resource_classes/index.json.jbuilder b/app/views/hyper_admin/resource_classes/index.json.jbuilder index abc1234..def5678 100644 --- a/app/views/hyper_admin/resource_classes/index.json.jbuilder +++ b/app/views/hyper_admin/resource_classes/index.json.jbuilder @@ -9,6 +9,7 @@ { key: attr, human: resource_class.human_attribute_name(attr), + type: resource_class.columns_hash[attr].type } end json.attributes attributes
Send attribute type along with resource class JSON
diff --git a/lib/guard/jruby-rspec/formatters/notification_rspec.rb b/lib/guard/jruby-rspec/formatters/notification_rspec.rb index abc1234..def5678 100644 --- a/lib/guard/jruby-rspec/formatters/notification_rspec.rb +++ b/lib/guard/jruby-rspec/formatters/notification_rspec.rb @@ -1,6 +1,15 @@ require "guard/rspec/formatter" -class Guard::JRubyRSpec::Formatter::NotificationRSpec < Guard::RSpec::Formatter +superclass = if Guard::RSpec::Formatter.instance_of? Module # guard-rspec-1.x + Object + elsif Guard::RSpec::Formatter.instance_of? Class # guard-rspec-2.x + Guard::RSpec::Formatter + else + fail 'Guard::RSpec::Formatter is neither class nor module' + end + +class Guard::JRubyRSpec::Formatter::NotificationRSpec < superclass + include Guard::RSpec::Formatter if Guard::RSpec::Formatter.instance_of? Module def dump_summary(duration, total, failures, pending) message = guard_message(total, failures, pending, duration)
Support both guard-rspec 1.x and 2.x Related: https://github.com/guard/guard-rspec/commit/31e1be02503c51ed37aeda486866550f7f8395d2#diff-5
diff --git a/api/app/controllers/spree/api/zones_controller.rb b/api/app/controllers/spree/api/zones_controller.rb index abc1234..def5678 100644 --- a/api/app/controllers/spree/api/zones_controller.rb +++ b/api/app/controllers/spree/api/zones_controller.rb @@ -4,7 +4,7 @@ def create authorize! :create, Zone - @zone = Zone.new(map_nested_attributes_keys(Spree::Zone, params[:zone])) + @zone = Zone.new(map_nested_attributes_keys(Spree::Zone, zone_params)) if @zone.save respond_with(@zone, :status => 201, :default_template => :show) else @@ -29,7 +29,7 @@ def update authorize! :update, zone - if zone.update_attributes(map_nested_attributes_keys(Spree::Zone, params[:zone])) + if zone.update_attributes(map_nested_attributes_keys(Spree::Zone, zone_params)) respond_with(zone, :status => 200, :default_template => :show) else invalid_resource!(zone) @@ -37,6 +37,9 @@ end private + def zone_params + params.require(:zone).permit! + end def zone @zone ||= Spree::Zone.accessible_by(current_ability, :read).find(params[:id])
Call permit! on zone params before passing to model Apparrantly as of rails 4.2 we must `permit` controller `params` before passing them to the model. Previous rails version `params` probably didn't respond to `permitted?` see https://github.com/rails/rails/blob/v4.2.0/activemodel/lib/active_model/forbidden_attributes_protection.rb
diff --git a/lib/kmdata.rb b/lib/kmdata.rb index abc1234..def5678 100644 --- a/lib/kmdata.rb +++ b/lib/kmdata.rb @@ -11,9 +11,8 @@ def get(path, params = {}) path = path_with_params("/api/#{path}.json", params) response = http.request(Net::HTTP::Get.new(path)) - process(JSON.parse(response.body)) + process(JSON.parse(response.body)) if response.code == "200" rescue Exception => exception - false end private
Return nil for both exceptions and when the response code isn't 200
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 @@ -1,20 +1,35 @@ class Users::RegistrationsController < Devise::RegistrationsController def update - # required for settings form to submit when password is left blank - if params[:user][:password].blank? - params[:user].delete("password") - params[:user].delete("password_confirmation") - end + @user = User.find(current_user.id) - @user = User.find(current_user.id) - if @user.update_attributes(params[:user]) - set_flash_message :notice, :updated - # Sign in the user bypassing validation in case his password changed - sign_in @user, bypass: true - redirect_to after_update_path_for(@user) + if user_params["password"].blank? + if @user.update_without_password( user_params ) + set_flash_message :notice, :updated + redirect_to after_update_path_for(@user) + else + render "devise/registrations/edit" + end else - render "devise/registrations/edit" + if @user.update_attributes(user_params) + set_flash_message :notice, :updated + # Sign in the user bypassing validation in case his password changed + sign_in @user, bypass: true + redirect_to after_update_path_for(@user) + else + render "devise/registrations/edit" + end end end + + private + + def user_params + params.require(:user).permit(:name, + :email, + :password, + :password_confirmation, + :avatar, + :avatar_cache) + end end
Update registration controller to permit avatar params
diff --git a/app/helpers/textual_mixins/textual_power_state.rb b/app/helpers/textual_mixins/textual_power_state.rb index abc1234..def5678 100644 --- a/app/helpers/textual_mixins/textual_power_state.rb +++ b/app/helpers/textual_mixins/textual_power_state.rb @@ -1,7 +1,7 @@ module TextualMixins::TextualPowerState def textual_power_state_whitelisted(state) state = state.blank? ? 'unknown' : state.downcase - quad_icon = QuadiconHelper::MACHINE_STATE_QUADRANT[state] + quad_icon = QuadiconHelper.machine_state(state) { :label => _('Power State'),
Use the machine_state method to determine powerstate icon/color
diff --git a/spec/helper.rb b/spec/helper.rb index abc1234..def5678 100644 --- a/spec/helper.rb +++ b/spec/helper.rb @@ -20,7 +20,7 @@ RSpec.configure do |config| config.filter_run :focused => true config.alias_example_to :fit, :focused => true - config.alias_example_to :xit, :disabled => true + config.alias_example_to :xit, :pending => true config.run_all_when_everything_filtered = true config.before(:each) do
Make xit mark things pending
diff --git a/spec/classes/hub_spec.rb b/spec/classes/hub_spec.rb index abc1234..def5678 100644 --- a/spec/classes/hub_spec.rb +++ b/spec/classes/hub_spec.rb @@ -0,0 +1,26 @@+require 'spec_helper' + +describe 'hub' do + let(:boxen_home) { '/opt/boxen' } + let(:config_dir) { "#{boxen_home}/config/git" } + let(:repo_dir) { "#{boxen_home}/repo" } + let(:env_dir) { "#{boxen_home}/env.d" } + let(:facts) do + { + :boxen_home => boxen_home, + :boxen_repodir => repo_dir, + :boxen_envdir => env_dir + } + end + + it { should include_class('boxen::config') } + it { should contain_package('hub').with_ensure('latest') } + + it 'sets up hub.sh file' do + should contain_file("#{env_dir}/hub.sh") + end + + it 'sets up global hub protocal config option' do + should contain_git__config__global('hub.protocol').with_value('https') + end +end
Add basic hub class test
diff --git a/lib/rails_email_preview/main_app_route_delegator.rb b/lib/rails_email_preview/main_app_route_delegator.rb index abc1234..def5678 100644 --- a/lib/rails_email_preview/main_app_route_delegator.rb +++ b/lib/rails_email_preview/main_app_route_delegator.rb @@ -1,7 +1,7 @@ module RailsEmailPreview::MainAppRouteDelegator # delegate url helpers to main_app def method_missing(method, *args, &block) - if method.to_s =~ /_(?:path|url)$/ && main_app.respond_to?(method) + if main_app_route_method?(method) main_app.send(method, *args) else super @@ -9,6 +9,11 @@ end def respond_to?(method) - super || main_app.respond_to?(method) + super || main_app_route_method?(method) + end + + private + def main_app_route_method?(method) + method.to_s =~ /_(?:path|url)$/ && main_app.respond_to?(method) end end
Fix minor bug in MainAppRouteDelegator
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index abc1234..def5678 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe User, type: :model do - pending "add some examples to (or delete) #{__FILE__}" end
Remove pendig user model spec
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index abc1234..def5678 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -0,0 +1,32 @@+require 'rails_helper' +require 'factory_girl_rails' + +describe User do + let(:user){ FactoryGirl.create(:user) } + + it "has a valid FACTORY" do + expect(FactoryGirl.create(:user)).to be_valid + end + + it "should have an email address" do + #when left blank, this tests for truthiness + expect(user.email).to be + end + + it "should have a valid email address" do + expect(user.email).to match(/^\w+.\w+@\w+.\w+$/) + end + + it 'should be able to create snippets' do + expect(user.snippets).to be + end + + it 'should be able to create stories' do + expect(user.stories).to be + end + + it 'should be able to vote' do + expect(user.votes).to be + end + +end
Make rudimentary tests for user model
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index abc1234..def5678 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -0,0 +1,13 @@+require 'rails_helper' + +RSpec.describe User, type: :model do + it "doesn't allow countries outside DACH" do + user = User.new name:"Ry", city: "Berlin", email: "a@example.com", country: "gb" + expect(user.valid?).to be(false) + end + + it "allows countries within DACH" do + user = User.new name:"Ry", city: "Berlin", email: "a@example.com", country: "de" + expect(user.valid?).to be(true) + end +end
Add simple country validation test Check happy and sad paths
diff --git a/spec/persistence_spec.rb b/spec/persistence_spec.rb index abc1234..def5678 100644 --- a/spec/persistence_spec.rb +++ b/spec/persistence_spec.rb @@ -1,4 +1,5 @@ require File.dirname(__FILE__) + "/../lib/odb" +require 'yard' class Post include ODB::Persistent @@ -14,15 +15,24 @@ describe ODB::Persistent do it "should save a post" do - db = ODB.new + db = ODB.new(ODB::JSONStore.new("Hello")) post = Post.new.tap {|p| p.title = "x"; p.author = "Joe"; p.comment = Comment.new } db.transaction do db.store[:post] = post db.store[:comment] = post.comment end + db = ODB.new(ODB::JSONStore.new("Hello")) db.store[:post].should == post db.store[:post].comment.object_id.should == db.store[:comment].object_id end + + it "should save a complex object" do + YARD.parse(File.dirname(__FILE__) + '/../lib/**/*.rb') + db = ODB.new(ODB::JSONStore.new("yard")) + db.transaction do + db.store[:registry] = YARD::Registry.instance + end + end end
Add spec for complex object
diff --git a/spec/support/stub_env.rb b/spec/support/stub_env.rb index abc1234..def5678 100644 --- a/spec/support/stub_env.rb +++ b/spec/support/stub_env.rb @@ -1,15 +1,33 @@+# Inspired by https://github.com/ljkbennett/stub_env/blob/master/lib/stub_env/helpers.rb module StubENV - def stub_env(key, value) - allow(ENV).to receive(:[]).and_call_original unless @env_already_stubbed - @env_already_stubbed ||= true + def stub_env(key_or_hash, value = nil) + init_stub unless env_stubbed? + if key_or_hash.is_a? Hash + key_or_hash.each { |k, v| add_stubbed_value(k, v) } + else + add_stubbed_value key_or_hash, value + end + end + + private + + STUBBED_KEY = '__STUBBED__'.freeze + + def add_stubbed_value(key, value) allow(ENV).to receive(:[]).with(key).and_return(value) + allow(ENV).to receive(:fetch).with(key).and_return(value) + allow(ENV).to receive(:fetch).with(key, anything()) do |_, default_val| + value || default_val + end + end + + def env_stubbed? + ENV[STUBBED_KEY] + end + + def init_stub + allow(ENV).to receive(:[]).and_call_original + allow(ENV).to receive(:fetch).and_call_original + add_stubbed_value(STUBBED_KEY, true) end end - -# It's possible that the state of the class variables are not reset across -# test runs. -RSpec.configure do |config| - config.after(:each) do - @env_already_stubbed = nil - end -end
Use a slightly cleaner approach to stub ENV Signed-off-by: Rémy Coutable <4ea0184b9df19e0786dd00b28e6daa4d26baeb3e@rymai.me>
diff --git a/app/helpers/application_helper/toolbar/catalogitem_buttons_center.rb b/app/helpers/application_helper/toolbar/catalogitem_buttons_center.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper/toolbar/catalogitem_buttons_center.rb +++ b/app/helpers/application_helper/toolbar/catalogitem_buttons_center.rb @@ -25,10 +25,16 @@ 'pficon pficon-delete fa-lg', t = N_('Remove this Button Group'), t, - :klass => ApplicationHelper::Button::CatalogItemButton, - :url_parms => "main_div", - :send_checked => true, - :confirm => N_("Warning: The selected Button Group will be permanently removed!")), + :klass => ApplicationHelper::Button::CatalogItemButton, + :data => {'function' => 'sendDataWithRx', + 'function-data' => {:controller => 'provider_dialogs', + :modal_title => N_('Delete Button Group'), + :modal_text => N_('Are you sure you want to delete the following Button Group?'), + :api_url => 'custom_button_sets', + :async_delete => false, + :redirect_url => '/catalog/explorer?report_deleted=true', + :transform_fn => 'buttonGroup', + :component_name => 'RemoveGenericItemModal'}}) ] ), ])
Use API + remove modal to delete button group
diff --git a/app/models/manageiq/providers/amazon/cloud_manager/refresh_worker.rb b/app/models/manageiq/providers/amazon/cloud_manager/refresh_worker.rb index abc1234..def5678 100644 --- a/app/models/manageiq/providers/amazon/cloud_manager/refresh_worker.rb +++ b/app/models/manageiq/providers/amazon/cloud_manager/refresh_worker.rb @@ -1,27 +1,7 @@ class ManageIQ::Providers::Amazon::CloudManager::RefreshWorker < ManageIQ::Providers::BaseManager::RefreshWorker require_nested :Runner - # overriding queue_name_for_ems so PerEmsWorkerMixin picks up *all* of the - # Amazon-manager types from here. - # This way, the refresher for Amazon's CloudManager will refresh *all* - # of the Amazon inventory across all managers. - class << self - def queue_name_for_ems(ems) - return ems unless ems.kind_of?(ExtManagementSystem) - combined_managers(ems).collect(&:queue_name).sort - end - - private - - def combined_managers(ems) - child_managers = ems.child_managers.reject do |child_ems| - child_ems.kind_of?(ManageIQ::Providers::Amazon::StorageManager::S3) - end - [ems].concat(child_managers) - end - end - - # MiQ complains if this isn't defined - def queue_name_for_ems(ems) + def self.combined_managers(ems) + super.reject { |e| e.kind_of?(ManageIQ::Providers::Amazon::StorageManager::S3) } end end
Move combined refresh workers to core Depends on: https://github.com/ManageIQ/manageiq/pull/20302
diff --git a/app/presenters/renalware/directory/person_auto_complete_presenter.rb b/app/presenters/renalware/directory/person_auto_complete_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/renalware/directory/person_auto_complete_presenter.rb +++ b/app/presenters/renalware/directory/person_auto_complete_presenter.rb @@ -3,8 +3,12 @@ module Renalware module Directory class PersonAutoCompletePresenter < DumbDelegator + def name_and_address + [family_name, given_name, address].compact.join(", ") + end + def to_hash - { id: id, label: to_s } + { id: id, label: name_and_address } end end end
Include address in label for autocomplete
diff --git a/app/models/model_cache.rb b/app/models/model_cache.rb index abc1234..def5678 100644 --- a/app/models/model_cache.rb +++ b/app/models/model_cache.rb @@ -17,15 +17,15 @@ end def discussion_for(discussion_id) - discussions.find_by id: discussion_id + discussions.select { |d| d.id == discussion_id.to_i } end def motion_for(discussion_id) - motions.find_by discussion_id: discussion_id + motions.select { |m| m.discussion_id == discusison_id.to_i } end def comment_for(discussion_id) - comments.find_by discussion_id: discussion_id + comments.select { |c| c.discussion_id == discussion_id.to_i } end def discussion_blurb_for(discussion_id)
Remove N+1 for loading discussions
diff --git a/app/models/task_status.rb b/app/models/task_status.rb index abc1234..def5678 100644 --- a/app/models/task_status.rb +++ b/app/models/task_status.rb @@ -13,7 +13,7 @@ default = TaskStatus.default_status unless default.nil? - if self.default_status + if self.default_status and not @update_position # Change the current default status to make sure there's only one default status default.default_status = false default.save @@ -24,7 +24,7 @@ def update_position(direction) position = self.position - if direction == 'up' + if direction.eql? 'up' status = TaskStatus.find_by_position(position.to_i - 1) else status = TaskStatus.find_by_position(position.to_i + 1) @@ -34,6 +34,7 @@ status.position = position TaskStatus.transaction do + @update_position = true self.save status.save end
Check if update is updating position
diff --git a/app/services/play_card.rb b/app/services/play_card.rb index abc1234..def5678 100644 --- a/app/services/play_card.rb +++ b/app/services/play_card.rb @@ -12,7 +12,7 @@ def call @round.game.with_lock do - assert_legal_move && play_card && increment_round + legal_move? && play_card && increment_round end @errors.none? @@ -20,7 +20,8 @@ private - def assert_legal_move + # TODO push out to player_options class and use a validate method + def legal_move? top_card = @round.pile.top return true if @card.playable_on?(top_card)
Refactor rename PlayCard method to be more idomatic
diff --git a/app/patches/rails/active_resource/delete_with_content_body.rb b/app/patches/rails/active_resource/delete_with_content_body.rb index abc1234..def5678 100644 --- a/app/patches/rails/active_resource/delete_with_content_body.rb +++ b/app/patches/rails/active_resource/delete_with_content_body.rb @@ -0,0 +1,47 @@+module ActiveResource + # Add a method that enables deletion with content body to + # ActiveRecord::Connection + class Connection + def delete_with_body(path, body = '', headers = {}) + with_auth { request(:delete, path, body.to_s, build_request_headers(headers, :delete, self.site.merge(path))) } + end + + def request(method, path, *arguments) + result = ActiveSupport::Notifications.instrument("request.active_resource") do |payload| + payload[:method] = method + payload[:request_uri] = "#{site.scheme}://#{site.host}:#{site.port}#{path}" + if method == :delete && arguments.size > 1 + payload[:result] = http.delete_with_body(path, *arguments) + else + payload[:result] = http.send(method, path, *arguments) + end + end + handle_response(result) + rescue Timeout::Error => e + raise TimeoutError.new(e.message) + rescue OpenSSL::SSL::SSLError => e + raise SSLError.new(e.message) + end + end + + # Override ActiveRecord::Base to check to content_body parameter. If its true + # then encode the body of the object and set it in the content body of the + # delete request + class Base + def destroy_with_body + connection.delete_with_body(element_path, encode, self.class.headers) + end + end + +end + +module Net + class HTTP + def delete_with_body(path, body, initheader = {'Depth' => 'Infinity'}) + req = Delete.new(path, initheader) + req.body = body + req.content_type = 'application/json' + request(req) + end + end +end
Add delete body support to Net::HTTP and ARes
diff --git a/Library/Formula/soprano.rb b/Library/Formula/soprano.rb index abc1234..def5678 100644 --- a/Library/Formula/soprano.rb +++ b/Library/Formula/soprano.rb @@ -1,13 +1,13 @@ require 'formula' class Soprano <Formula - @url='http://downloads.sourceforge.net/project/soprano/Soprano/2.3.1/soprano-2.3.1.tar.bz2' + @url='http://downloads.sourceforge.net/project/soprano/Soprano/2.3.70/soprano-2.3.70.tar.bz2' @homepage='http://soprano.sourceforge.net/' - @md5='c9a2c008b80cd5d76599e9d48139dfe9' + @md5='de5cf230a95fc7218425aafdfb4a5e47' depends_on 'cmake' + depends_on 'd-bus' depends_on 'qt' - depends_on 'clucene' depends_on 'redland' def install
Update Soprano to 2.3.70 and update dependencies.
diff --git a/db/migrate/20180524190818_destroy_non_existing_git_hub_users.rb b/db/migrate/20180524190818_destroy_non_existing_git_hub_users.rb index abc1234..def5678 100644 --- a/db/migrate/20180524190818_destroy_non_existing_git_hub_users.rb +++ b/db/migrate/20180524190818_destroy_non_existing_git_hub_users.rb @@ -1,6 +1,14 @@ class DestroyNonExistingGitHubUsers < ActiveRecord::Migration[5.1] + def up - unless ENV['RAILS_ENV'] == 'development' + return if ENV['RAILS_ENV'] == 'test' + if ENV['RAILS_ENV'] == 'development' + puts "Updating users with github_id ...." + users = User.all.select { |user| user.github_id.nil? } + users.each_with_index do |user, index| + user.update!(github_id: index + 10) + end + else User.where(github_id: nil).destroy_all.each do |user| puts "removed user #{user.id} from database" end
Handle user records without github_id; skip in test env
diff --git a/lib/convection/model/template/resource/aws_route53_recordset.rb b/lib/convection/model/template/resource/aws_route53_recordset.rb index abc1234..def5678 100644 --- a/lib/convection/model/template/resource/aws_route53_recordset.rb +++ b/lib/convection/model/template/resource/aws_route53_recordset.rb @@ -26,16 +26,28 @@ property :record_type, 'Type' property :weight, 'Weight' + # Add new resource_property functionality def alias_target(&block) a = ResourceProperty::Route53AliasTarget.new(self) a.instance_exec(&block) if block properties['AliasTarget'].set(a) end + # Maintain backwards compatability + def alias_target(obj) + alias_tgt obj + end + + # Add new resource_property functionality def geo_location(&block) g = ResourceProperty::Route53GeoLocation.new(self) g.instance_exec(&block) if block properties['GeoLocation'].set(g) + end + + # Maintain backwards compatability + def geo_location(obj) + geo_loc obj end end end
Maintain backwards compatability with route53 Previously, users needed to specify the json for alias_target and geo_location for a route53_recordset. In the add-alb branch, merged in PR 214, this was changed in a backwards-incompatible way, requiring anyone who had previously specified json to now specify a block for the resource_property. Now, either way is acceptable. This is potentially a paradigm that can be used elsewhere, as there are many places where a resource_property would be appropriate, but has not existed and users have implemented the functionality directly with a json (or ruby hash) object. This will allow us to deprecate that method in favor of the more clean resource_property approach, without breaking everything in a 1.0 upgrade.
diff --git a/db/migrate/20160127210623_create_settings_changes_table.rb b/db/migrate/20160127210623_create_settings_changes_table.rb index abc1234..def5678 100644 --- a/db/migrate/20160127210623_create_settings_changes_table.rb +++ b/db/migrate/20160127210623_create_settings_changes_table.rb @@ -5,7 +5,7 @@ t.string :name t.string :key t.text :value - t.timestamps + t.timestamps :null => false end add_index :settings_changes, :key add_index :settings_changes, [:resource_id, :resource_type]
Remove deprecation warning about timestamps :null => false for Rails 5
diff --git a/db/migrate/20170406102944_add_vendor_id_to_spree_models.rb b/db/migrate/20170406102944_add_vendor_id_to_spree_models.rb index abc1234..def5678 100644 --- a/db/migrate/20170406102944_add_vendor_id_to_spree_models.rb +++ b/db/migrate/20170406102944_add_vendor_id_to_spree_models.rb @@ -0,0 +1,16 @@+class AddVendorIdToSpreeModels < ActiveRecord::Migration + def change + table_names = %w[ + option_types + properties + products + stock_locations + shipping_methods + variants + ] + + table_names.each do |table_name| + add_reference "spree_#{table_name}", :vendor, index: true + end + end +end
Add vendor_id to tables that going to be vendorized
diff --git a/lib/inline_svg/transform_pipeline/transformations/data_attributes.rb b/lib/inline_svg/transform_pipeline/transformations/data_attributes.rb index abc1234..def5678 100644 --- a/lib/inline_svg/transform_pipeline/transformations/data_attributes.rb +++ b/lib/inline_svg/transform_pipeline/transformations/data_attributes.rb @@ -1,12 +1,11 @@ module InlineSvg::TransformPipeline::Transformations class DataAttributes < Transformation def transform(doc) - doc = Nokogiri::XML::Document.parse(doc.to_html) - svg = doc.at_css 'svg' - with_valid_hash_from(self.value).each_pair do |name, data| - svg["data-#{dasherize(name)}"] = data + with_svg(doc) do |svg| + with_valid_hash_from(self.value).each_pair do |name, data| + svg["data-#{dasherize(name)}"] = data + end end - doc end private
Handle documents without SVG root elements
diff --git a/Formula/ruby.rb b/Formula/ruby.rb index abc1234..def5678 100644 --- a/Formula/ruby.rb +++ b/Formula/ruby.rb @@ -1,12 +1,13 @@ require 'formula' +# TODO de-version the include and lib directories + class Ruby <Formula - url 'ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p243.tar.gz' - homepage 'http://www.ruby-lang.org/en/' - md5 '515bfd965814e718c0943abf3dde5494' + @url='ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p243.tar.gz' + @homepage='http://www.ruby-lang.org/en/' + @md5='515bfd965814e718c0943abf3dde5494' depends_on 'readline' - skip_clean 'bin/ruby' def install ENV.gcc_4_2 @@ -16,29 +17,12 @@ "--enable-shared" system "make" system "make install" - - unless ARGV.include? '--enable-super-dupe' - Dir.chdir prefix - FileUtils.rm_rf Dir['lib/ruby/*/rubygems'] - FileUtils.rm_rf Dir['lib/ruby/*/rake'] - File.unlink 'bin/gem' - File.unlink 'bin/rake' - File.unlink man1+'rake.1' - end end - def caveats; <<-EOS -By default we don't install the bundled Rake or RubyGems. - -This is because they both come with the system installed Ruby. You can upgrade -them with `gem update --system`. - -If you really want them though do: - - brew install ruby --force --enable-super-dupe - -If you disagree with this decision, please create an issue on GitHub as we -should discuss the matter. - EOS + def skip_clean? path + # TODO only skip the clean for the files that need it, we didn't get a + # comment about why we're skipping the clean, so you'll need to figure + # that out first --mxcl + true end end
Revert "Don't install gem or rake" This reverts commit d0ed812b3dfa94507ac3c6c9b4a8ec54c1f3251f. Fixes Homebrew/homebrew#129
diff --git a/samples/elb.rb b/samples/elb.rb index abc1234..def5678 100644 --- a/samples/elb.rb +++ b/samples/elb.rb @@ -13,4 +13,14 @@ puts "", "Your Load Balancers", "" -p $elb.describe_load_balancesr +$elb.describe_load_balancers.describe_load_balancers_result.load_balancer_descriptions.each do |elb| + puts "Name: #{elb.load_balancer_name}" + puts "HealthCheck: #{elb.health_check.inspect}" + + elb.listener_descriptions.each do |desc| + l = desc.listener + puts "Listener: #{l.protocol}:#{l.load_balancer_port} => #{l.instance_protocol}:#{l.instance_port}" + end + + puts "" +end
Update ELB sample to show usage