diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - root to: "requests#index" + root to: 'welcome#index' get '/login', :to => 'sessions#new', :as => :login get '/logout', :to => 'sessions#destroy', :as => :logout
Change route path to welcome
diff --git a/auth_proxy/config/environment.rb b/auth_proxy/config/environment.rb index abc1234..def5678 100644 --- a/auth_proxy/config/environment.rb +++ b/auth_proxy/config/environment.rb @@ -24,18 +24,4 @@ # Load Mongoid's configuration for this specific environment. require "mongoid" - -# FIXME: Disable MongoDB logging for performance. Currently a simple monkey -# patch. -# -# Mongoid.logger = nil currently doesn't work, but should be fixed in next -# release. https://github.com/mongoid/mongoid/issues/734 -# -# Mongoid.logger = nil -module Mongoid - def self.logger - nil - end -end - Mongoid.load!(::File.join(AUTH_PROXY_ROOT, "config", "mongoid.yml"))
Remove mongoid logger monkeypatch, since this can now be configured in database.yml.
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -13,8 +13,6 @@ # For details on the DSL available within this file, see # http://guides.rubyonrails.org/routing.html root to: 'home#index' + + get "/pages/:page" => "pages#show", as: :page end - -Rails.application.routes.draw do - get "/pages/:page" => "pages#show" -end
Add route alias for /pages/:page
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2,8 +2,8 @@ resources :spec, :controller => 'spec', :only => [:index] do get "fixtures/*filename", :action => :fixtures end - match "fixtures/*filename", :to => "spec#fixtures" - match "/(:suite)", :to => "spec#index", defaults: { suite: nil } + get "fixtures/*filename", :to => "spec#fixtures" + get "/(:suite)", :to => "spec#index", defaults: { suite: nil } end if Jasminerice.mount
Support Rails 4 style routing.
diff --git a/gemstrap.gemspec b/gemstrap.gemspec index abc1234..def5678 100644 --- a/gemstrap.gemspec +++ b/gemstrap.gemspec @@ -19,5 +19,5 @@ s.test_files = Dir['spec/**/*'] s.add_development_dependency 'rake', '~> 0' - s.add_development_dependency 'rspec-core', '~> 0' + s.add_development_dependency 'rspec', '~> 0' end
Use rspec dependency instead of rspec-core
diff --git a/spec/controllers/optin_cost_items_controller_spec.rb b/spec/controllers/optin_cost_items_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/optin_cost_items_controller_spec.rb +++ b/spec/controllers/optin_cost_items_controller_spec.rb @@ -31,7 +31,4 @@ response.should be_success end - it "should send a notification email when this fails" do - "this".should == 'fail' - end end
Revert "test automated build notification" This reverts commit f78c805bac122b1247ddb02f8af33d5c244ee4bc.
diff --git a/Formula.rb b/Formula.rb index abc1234..def5678 100644 --- a/Formula.rb +++ b/Formula.rb @@ -0,0 +1,14 @@+class Swish < Formula + desc "Build your Swift projects on a remote machine." + homepage "https://github.com/thomaspaulmann/Swish" + url "https://github.com/thomaspaulmann/Swish/archive/X.Y.Z.tar.gz" + sha256 "..." + + def install + bin.install "swish" + end + + test do + system bin/"swish" + end +end
Add template for homebrew formula
diff --git a/gembots.gemspec b/gembots.gemspec index abc1234..def5678 100644 --- a/gembots.gemspec +++ b/gembots.gemspec @@ -4,7 +4,7 @@ Gem::Specification.new do |spec| spec.name = "gembots" - spec.version = '0.1.1' + spec.version = '0.1.2' spec.authors = ["L8D"] spec.email = ["tenorbiel@gmail.com"] spec.description = %q{Library for creating Gembots}
Update to 0.1.2 for documentation
diff --git a/test/representers/api/podcast_distribution_representer_test.rb b/test/representers/api/podcast_distribution_representer_test.rb index abc1234..def5678 100644 --- a/test/representers/api/podcast_distribution_representer_test.rb +++ b/test/representers/api/podcast_distribution_representer_test.rb @@ -0,0 +1,34 @@+# encoding: utf-8 + +require 'test_helper' +require 'distribution' if !defined?(Distribution) + +describe Api::PodcastDistributionRepresenter do + + let(:distribution) { build(:podcast_distribution) } + let(:representer) { Api::DistributionRepresenter.new(distribution) } + let(:json) { JSON.parse(representer.to_json) } + + before do + stub_request(:get, "http://feeder.docker/api/v1"). + with(:headers => {'Accept'=>'application/json', 'Authorization'=>'Bearer token', 'Content-Type'=>'application/json'}). + to_return(:status => 200, :body => json_file('feeder_root')) + + stub_request(:post, "http://feeder.docker/api/v1/podcasts"). + with(:headers => {'Authorization'=>'Bearer token', 'Content-Type'=>'application/json'}). + to_return(:status => 200, :body => json_file('podcast'), :headers => {}) + + distribution.stub(:get_account_token, "token") do + distribution.save! + end + end + + it 'create representer' do + representer.wont_be_nil + end + + it 'use representer to create json' do + json['id'].must_equal distribution.id + json['properties']['explicit'].must_equal 'clean' + end +end
Add test for podcast distro representer as well
diff --git a/recipes/fw_ssh.rb b/recipes/fw_ssh.rb index abc1234..def5678 100644 --- a/recipes/fw_ssh.rb +++ b/recipes/fw_ssh.rb @@ -1,3 +1,5 @@+include_recipe "cespi_server_security::_fw_basic" + simple_iptables_rule "ssh" do direction "INPUT" rule rule_for("ssh")
Add required cookbook to ssh
diff --git a/lib/exercism/syntax_highlighter.rb b/lib/exercism/syntax_highlighter.rb index abc1234..def5678 100644 --- a/lib/exercism/syntax_highlighter.rb +++ b/lib/exercism/syntax_highlighter.rb @@ -8,6 +8,7 @@ 'elisp' => 'common_lisp', 'plsql' => 'sql', 'ecmascript' => 'javascript', + 'perl5' => 'perl', } attr_reader :lexer, :code
Fix missing syntax highlighting for perl
diff --git a/lib/middleman/jasmine/extension.rb b/lib/middleman/jasmine/extension.rb index abc1234..def5678 100644 --- a/lib/middleman/jasmine/extension.rb +++ b/lib/middleman/jasmine/extension.rb @@ -12,9 +12,11 @@ yield options if block_given? app.map(options.jasmine_url) { run ::JasmineSprocketsProxy.new } - jasmine_asset_folders(options.fixtures_dir).each do |item| + jasmine_asset_folders.each do |item| app.map("/#{item}") { run ::JasmineSprocketsProxy.new(item) } end + + app.map("/#{options.fixtures_dir}") { run Rack::Directory.new(options.fixtures_dir) } app.after_configuration do ::JasmineSprocketsProxy.configure(sprockets) @@ -23,9 +25,9 @@ private - def jasmine_asset_folders(fixtures_dir) + def jasmine_asset_folders [ - "__jasmine__", "__boot__", "__spec__", fixtures_dir + "__jasmine__", "__boot__", "__spec__" ] end
Revise so fixtures files are served with a Rack::Directory
diff --git a/rb/lib/selenium/webdriver/iphone/bridge.rb b/rb/lib/selenium/webdriver/iphone/bridge.rb index abc1234..def5678 100644 --- a/rb/lib/selenium/webdriver/iphone/bridge.rb +++ b/rb/lib/selenium/webdriver/iphone/bridge.rb @@ -10,6 +10,8 @@ DEFAULT_URL = "http://#{Platform.localhost}:3001/wd/hub/" def initialize(opts = {}) + warn 'The iPhone driver is reprecated - please use http://appium.io/ or http://ios-driver.github.io/ios-driver/ instead' + remote_opts = { :url => opts.fetch(:url, DEFAULT_URL), :desired_capabilities => opts.fetch(:desired_capabilities, capabilities),
Add deprecation warning to the Ruby iPhone driver.
diff --git a/lib/generators/active_record/authic_generator.rb b/lib/generators/active_record/authic_generator.rb index abc1234..def5678 100644 --- a/lib/generators/active_record/authic_generator.rb +++ b/lib/generators/active_record/authic_generator.rb @@ -11,9 +11,9 @@ def copy_authic_migration if (behavior == :invoke && model_exists?) || (behavior == :revoke && migration_exists?(table_name)) - migration_template "migration_existing.rb", "db/migrate/add_authic_to_#{table_name}" + migration_template "migration_existing.rb", "db/migrate/add_authic_to_#{table_name}.rb" else - migration_template "migration.rb", "db/migrate/authic_create_#{table_name}" + migration_template "migration.rb", "db/migrate/authic_create_#{table_name}.rb" end end @@ -40,7 +40,7 @@ def migration_data <<RUBY - + RUBY end end
Include the file extension on the end of the generated migrations
diff --git a/app/controllers/spree/api/ams/users_controller.rb b/app/controllers/spree/api/ams/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/spree/api/ams/users_controller.rb +++ b/app/controllers/spree/api/ams/users_controller.rb @@ -12,9 +12,9 @@ @user.generate_spree_api_key! unless @user.spree_api_key render json: { - user_id: @user.id, - user_email: @user.email, - user_token: @user.spree_api_key + id: @user.id, + email: @user.email, + token: @user.spree_api_key } else # Wrong Password @@ -38,4 +38,4 @@ end end end -end+end
Update Token Response for Simple Auth
diff --git a/db/migrate/20160517162119_update_users_dummy_col_to_false.rb b/db/migrate/20160517162119_update_users_dummy_col_to_false.rb index abc1234..def5678 100644 --- a/db/migrate/20160517162119_update_users_dummy_col_to_false.rb +++ b/db/migrate/20160517162119_update_users_dummy_col_to_false.rb @@ -0,0 +1,6 @@+class UpdateUsersDummyColToFalse < ActiveRecord::Migration + Users.where(dummy: nil).update_all(dummy: false) + def change + change_column :users, :dummy, :boolean, :default => false, :null => false + end +end
Update existing dummy to false and change dummy column to default to false
diff --git a/src/ruby/jtestr/expectations_support.rb b/src/ruby/jtestr/expectations_support.rb index abc1234..def5678 100644 --- a/src/ruby/jtestr/expectations_support.rb +++ b/src/ruby/jtestr/expectations_support.rb @@ -2,22 +2,6 @@ require 'expectations' require 'jtestr/expectations_result_handler' - -module Expectations - class SuiteResults - class << self - alias original_new new - - def new(*args) - if $__running_jtestr_expectations - JtestR::ExpectationsResultHandler.new($__running_jtestr_expectations) - else - original_new(*args) - end - end - end - end -end module JtestR module ExpectationsTestRunning @@ -44,13 +28,12 @@ end begin - $__running_jtestr_expectations = JtestR.result_handler.new(group.name, "example", @output, @output_level) + result_handler = JtestR::ExpectationsResultHandler.new(JtestR.result_handler.new(group.name, "example", @output, @output_level)) - result = suite_runner.suite.execute + result = suite_runner.suite.execute(STDOUT, result_handler) @result &= result.succeeded? ensure - $__running_jtestr_expectations = nil suite_runner.suite = old_suite end @@ -59,6 +42,5 @@ log.err e.inspect log.err e.backtrace end - end end
Make expectations support had the proper hook for result output, instead of ugly monkey patching
diff --git a/recipes/attribute_driven.rb b/recipes/attribute_driven.rb index abc1234..def5678 100644 --- a/recipes/attribute_driven.rb +++ b/recipes/attribute_driven.rb @@ -18,9 +18,9 @@ node[:collectd][:plugins].each_pair do |plugin_key, definition| collectd_plugin plugin_key.to_s do - config definition[:config] if definition[:config] - config definition[:template] if definition[:template] - config definition[:cookbook] if definition[:cookbook] - config definition[:type] if definition[:type] + config definition[:config].to_hash if definition[:config] + config definition[:template].to_s if definition[:template] + config definition[:cookbook].to_s if definition[:cookbook] + config definition[:type].to_s if definition[:type] end end
Make sure the attributes are converted when passing to the resource
diff --git a/lib/statsd/instrument/backends/logger_backend.rb b/lib/statsd/instrument/backends/logger_backend.rb index abc1234..def5678 100644 --- a/lib/statsd/instrument/backends/logger_backend.rb +++ b/lib/statsd/instrument/backends/logger_backend.rb @@ -8,7 +8,7 @@ end def collect_metric(metric) - logger.debug "[StatsD] #{metric}" + logger.info "[StatsD] #{metric}" end end end
Use info as log level in the logger backend
diff --git a/test/lib/generators/rabl/resource_generator_test.rb b/test/lib/generators/rabl/resource_generator_test.rb index abc1234..def5678 100644 --- a/test/lib/generators/rabl/resource_generator_test.rb +++ b/test/lib/generators/rabl/resource_generator_test.rb @@ -16,6 +16,6 @@ run_generator assert_file "app/views/accounts/show.rabl", %r(object @account) assert_file "app/views/accounts/index.rabl", %r(collection @accounts) - assert_not_empty Dir.glob(File.join(Rails.root, "db/migrate/*create_account*")) + assert_not_equal [], Dir.glob(File.join(Rails.root, "db/migrate/*create_account*")) end end
Fix assertion for Ruby 1.8.7 (Test::Unit 1.2.3)
diff --git a/autoprefixer-rails.gemspec b/autoprefixer-rails.gemspec index abc1234..def5678 100644 --- a/autoprefixer-rails.gemspec +++ b/autoprefixer-rails.gemspec @@ -10,7 +10,7 @@ s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {spec}/*`.split("\n") - s.extra_rdoc_files = ['README.md', 'LICENSE', 'ChangeLog.md'] + s.extra_rdoc_files = ['README.md', 'LICENSE', 'CHANGELOG.md'] s.require_path = 'lib' s.author = 'Andrey Sitnik'
Fix docs file names in gemspec
diff --git a/spec/lib/resque_job_logging_spec.rb b/spec/lib/resque_job_logging_spec.rb index abc1234..def5678 100644 --- a/spec/lib/resque_job_logging_spec.rb +++ b/spec/lib/resque_job_logging_spec.rb @@ -9,7 +9,7 @@ Rails.stub!(:logger).and_return(mock()) Rails.logger.should_receive(:auto_flushing=).with(1) - Object.const_set("ResqueJobLoggingDummy", Class.new(Object)) + silence_warnings { Object.const_set("ResqueJobLoggingDummy", Class.new(Object)) } ResqueJobLoggingDummy.extend(ResqueJobLogging) end
Remove annoying constant warning from resque spec
diff --git a/lib/em-websocket/websocket.rb b/lib/em-websocket/websocket.rb index abc1234..def5678 100644 --- a/lib/em-websocket/websocket.rb +++ b/lib/em-websocket/websocket.rb @@ -1,16 +1,18 @@ module EventMachine module WebSocket + class << self + attr_accessor :max_frame_size + end + @max_frame_size = 10 * 1024 * 1024 # 10MB + # All errors raised by em-websocket should descend from this class - # class WebSocketError < RuntimeError; end # Used for errors that occur during WebSocket handshake - # class HandshakeError < WebSocketError; end # Used for errors which should cause the connection to close. # See RFC6455 §7.4.1 for a full description of meanings - # class WSProtocolError < WebSocketError def code; 1002; end end @@ -20,33 +22,28 @@ def code; 1009; end end + # Start WebSocket server, including starting eventmachine run loop def self.start(options, &blk) EM.epoll - EM.run do - + EM.run { trap("TERM") { stop } trap("INT") { stop } run(options, &blk) - - end + } end - def self.run(options, &blk) - EventMachine::start_server(options[:host], options[:port], - EventMachine::WebSocket::Connection, options) do |c| - blk.call(c) + # Start WebSocket server inside eventmachine run loop + def self.run(options) + host, port = options.values_at(:host, :port) + EM.start_server(host, port, Connection, options) do |c| + yield c end end def self.stop puts "Terminating WebSocket Server" - EventMachine.stop + EM.stop end - - class << self - attr_accessor :max_frame_size - end - @max_frame_size = 10 * 1024 * 1024 # 10MB end end
Clean up the code in WebSocket module
diff --git a/lib/sprockets/unprocessed_asset.rb b/lib/sprockets/unprocessed_asset.rb index abc1234..def5678 100644 --- a/lib/sprockets/unprocessed_asset.rb +++ b/lib/sprockets/unprocessed_asset.rb @@ -18,6 +18,7 @@ if @source.include?("@import") # Process Sass and Less files, since @import is too tricky to handle properly. allowed_engines << Sass::Rails::ScssTemplate if defined?(Sass::Rails::ScssTemplate) + allowed_engines << Sass::Rails::SassTemplate if defined?(Sass::Rails::SassTemplate) allowed_engines << Less::Rails::LessTemplate if defined?(Less::Rails::LessTemplate) processors = attributes.processors - (attributes.engines - allowed_engines) @source = context.evaluate(pathname, :processors => processors)
Allow Sass engine as well
diff --git a/lib/front_end_tasks/server.rb b/lib/front_end_tasks/server.rb index abc1234..def5678 100644 --- a/lib/front_end_tasks/server.rb +++ b/lib/front_end_tasks/server.rb @@ -5,6 +5,7 @@ include WEBrick def self.start(opts) + HTTPUtils::DefaultMimeTypes.store('manifest', 'text/cache-manifest') server = HTTPServer.new(:Port => opts[:port], :DocumentRoot => opts[:public_dir]) trap("INT") { server.shutdown } server.start
Set content type for .manifest files
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -11,5 +11,6 @@ # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. + config.time_zone = 'Eastern Time (US & Canada)' end end
Add time zone to config
diff --git a/app/controllers/coronavirus/live_stream_controller.rb b/app/controllers/coronavirus/live_stream_controller.rb index abc1234..def5678 100644 --- a/app/controllers/coronavirus/live_stream_controller.rb +++ b/app/controllers/coronavirus/live_stream_controller.rb @@ -11,9 +11,9 @@ @live_stream = LiveStream.last if @live_stream.update(url: url_params, formatted_stream_date: formatted_date) if updater.update - flash[:notice] = I18n.t("coronavirus.live_stream.update.success") + flash[:notice] = helpers.t("coronavirus.live_stream.update.success") else - flash[:alert] = I18n.t("coronavirus.live_stream.update.failed") + flash[:alert] = helpers.t("coronavirus.live_stream.update.failed") end else flash[:alert] = @live_stream.errors.full_messages.join(", ") @@ -23,9 +23,9 @@ def publish if updater.publish - flash[:notice] = I18n.t("coronavirus.live_stream.publish.success") + flash[:notice] = helpers.t("coronavirus.live_stream.publish.success") else - flash[:alert] = I18n.t("coronavirus.live_stream.publish.failed") + flash[:alert] = helpers.t("coronavirus.live_stream.publish.failed") end redirect_to coronavirus_live_stream_index_path end
Raise exception for missing livestream translation We already have `config.action_view.raise_on_missing_translations = true` set so an error will be raised if a view tries to call a missing translation. However, to get the same effect with content called from a controller, the method needs to be called with a `!`. i.e. `I18n.t!`. Rather than call translations without a bang in the views, but with one in the controllers, we can instead use the helper method from the view.
diff --git a/app/controllers/coursewareable/sessions_controller.rb b/app/controllers/coursewareable/sessions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/coursewareable/sessions_controller.rb +++ b/app/controllers/coursewareable/sessions_controller.rb @@ -16,11 +16,10 @@ # New session handler def create user = login(params[:email], params[:password], params[:remember_me]) + subdomain = request.subdomain unless request.subdomain.blank? || false if user - flash[:notice] = _( - 'Welcome back %{name}!' % {:name => user.name} - ) - redirect_back_or_to(root_url) + flash[:notice] = _('Welcome back %{name}!' % {:name => user.name}) + redirect_back_or_to(root_url(:subdomain => subdomain)) else flash.now.alert = _('Email or password was invalid.') render :new @@ -30,7 +29,8 @@ # Destroys session, aka logout def destroy logout - redirect_to root_url, :notice => _('Logged out!') + subdomain = request.subdomain unless request.subdomain.blank? || false + redirect_to root_url(:subdomain => subdomain), :notice => _('Logged out!') end end end
Clean up sessions controller to work on subdomains too.
diff --git a/config/environment.rb b/config/environment.rb index abc1234..def5678 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -4,7 +4,7 @@ # Initialize the rails application Hyperarchy::Application.initialize! -redis_uri = URI.parse(ENV["REDISTOGO_URL"]) +redis_uri = URI.parse(ENV["REDISTOGO_URL"] || ENV["REDISCLOUD_URL"]) $redis = Redis.new(:host => redis_uri.host, :port => redis_uri.port, :password => redis_uri.password) APP_NAME = ENV['APP_NAME'] || 'Hyperarchy'
Add REDISCLOUD_URL as a second redis option.
diff --git a/lib/langs/mi.rb b/lib/langs/mi.rb index abc1234..def5678 100644 --- a/lib/langs/mi.rb +++ b/lib/langs/mi.rb @@ -0,0 +1,23 @@+# encoding: utf-8 +class Language_mi < Language + + def initialize + @STRINGS = { + :pleaseenteraletter => "Tēnā tomo hetahi rata: ", # Please enter one letter: + :inputisnotlowercase => "e kore te tāuru pūriki", # Input (is) not lowercase + :inputhasalreadybeenguessed => "Tāuru mea kua kētia fifili ki", # Input has already (been) gussed + :inputisinvalid => "He muhu tāuru", # Invalid input + :gameover => "KĒMU KI RUNGA!", # GAME OVER + :youwon => "I riro koe!", # You won! + :youlost => "I ngaro koe!", # You lost! + :youhavelivesremaining => "Kua koe :lives mau oraraa toe", # You have :lives more lives + :youhadlivesremaining => "I koe :lives mau oraraa toe", # You have :lives more lives (no had tense?) + :currentguessis => "Mana'ona'oraa ta- o nāianei ko te: :guess", # Current guess is: :guess + :finalguesswas => "Mana'ona'oraa ta- whakamutunga ko te: :guess", # Last guess is: :guess + :youhaveguessed => "Koe kua fifili: :guesses", # You have guessed: :guesses + :youhadguessed => "I kua koe fifili: :guesses", # You have guessed: :guesses (no had tense?) + :thewordwas => "Ko te kupu a: :word", # The word: :word + } + end + +end
Add māori translations. To check..
diff --git a/exercise-one/euklid.rb b/exercise-one/euklid.rb index abc1234..def5678 100644 --- a/exercise-one/euklid.rb +++ b/exercise-one/euklid.rb @@ -13,12 +13,17 @@ ( a*a + b*b ) != 0 end +def a_b_positive + @a, @b = @a.abs, @b.abs +end + def a_larger_b @a, @b = @b, @a if @b > @a end # Main function if valid_input(@a, @b) + a_b_positive a_larger_b calculate_gcd(@a, @b) r = -1 # initial value to define error in calculation
Add handling for negative numbers
diff --git a/rorvswild.gemspec b/rorvswild.gemspec index abc1234..def5678 100644 --- a/rorvswild.gemspec +++ b/rorvswild.gemspec @@ -17,6 +17,4 @@ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - - spec.add_development_dependency "bundler", "~> 1.6" end
Remove bundler has development dependency.
diff --git a/lib/active_record/turntable/util.rb b/lib/active_record/turntable/util.rb index abc1234..def5678 100644 --- a/lib/active_record/turntable/util.rb +++ b/lib/active_record/turntable/util.rb @@ -12,8 +12,13 @@ ActiveRecord.gem_version.release end + def ar51_or_later? + ar_version_equals_or_later?("5.1") + end + module_function :ar_version_equals_or_later?, :ar_version_earlier_than?, - :ar_version + :ar_version, + :ar51_or_later? end end
Add method `ar51_or_later?` that checks the version equals to or later `5.1`
diff --git a/recipes/zookeeper.rb b/recipes/zookeeper.rb index abc1234..def5678 100644 --- a/recipes/zookeeper.rb +++ b/recipes/zookeeper.rb @@ -36,11 +36,10 @@ if !Dir.exists?(::File.join(Chef::Config[:file_cache_path], zk_basename)) execute 'install zookeeper' do - user "root" + user node[:exhibitor][:user] cwd Chef::Config[:file_cache_path] command <<-eos - tar zxf #{zk_basename}.tar.gz - cp -r #{zk_basename} #{node[:zookeeper][:install_dir]} + tar -C #{node[:zookeeper][:install_dir]} -zxf #{zk_basename}.tar.gz eos end end
Change dir as exhibitor user when decompressing ZK archive
diff --git a/lib/grim.rb b/lib/grim.rb index abc1234..def5678 100644 --- a/lib/grim.rb +++ b/lib/grim.rb @@ -6,10 +6,10 @@ WIDTH = 1024 # Default image quality, 1 to 100 - QUALITY = 90 + QUALITY = 75 # Default density, any positive integer - DENSITY = 300 + DENSITY = 150 # Default exception class for Grim. class Exception < ::StandardError
Change defaults of QUALITY and DENSITY based on trial and error. This gives you optimal speed and file size. About 40% faster and 40% smaller using 75/150 instead of 90/300.
diff --git a/spec/features/module_proposal_management_spec.rb b/spec/features/module_proposal_management_spec.rb index abc1234..def5678 100644 --- a/spec/features/module_proposal_management_spec.rb +++ b/spec/features/module_proposal_management_spec.rb @@ -14,7 +14,7 @@ fill_in "Email", with: "jonesjoe@example" fill_in "University", with: "East Carolina University" fill_in "Department", with: "English" - fill_in "Working Title", with: "My Module Idea" + fill_in "Proposed Module Title", with: "My Module Idea" fill_in "description of the proposed content", with: "My description" fill_in "estimated start date", with: "#{time.year}-#{time.month}-#{time.day}" time += 86400
Update module proposals feature spec Update Title label in feature spec.
diff --git a/lib/fluent/plugin/in_rds_slowlog.rb b/lib/fluent/plugin/in_rds_slowlog.rb index abc1234..def5678 100644 --- a/lib/fluent/plugin/in_rds_slowlog.rb +++ b/lib/fluent/plugin/in_rds_slowlog.rb @@ -49,10 +49,11 @@ def output slow_log_data = [] slow_log_data = @client.query('SELECT * FROM slow_log', :cast => false) - @client.query('CALL mysql.rds_rotate_slow_log') slow_log_data.each do |row| Fluent::Engine.emit(tag, Fluent::Engine.now, row) end + + @client.query('CALL mysql.rds_rotate_slow_log') end end
CALL mysql.rds_rotate_slow_log move to after emit
diff --git a/lib/fog/aws/models/rds/log_files.rb b/lib/fog/aws/models/rds/log_files.rb index abc1234..def5678 100644 --- a/lib/fog/aws/models/rds/log_files.rb +++ b/lib/fog/aws/models/rds/log_files.rb @@ -19,7 +19,7 @@ def all(filters=filters) self.filters.merge!(filters) - result = service.describe_db_log_files(rds_id, filters).body['DescribeDBLogFilesResult'] + result = service.describe_db_log_files(rds_id, self.filters).body['DescribeDBLogFilesResult'] self.filters[:marker] = result['Marker'] load(result['DBLogFiles']) end
Use correct filters in RDS model logfiles 'all' method
diff --git a/db/migrate/20150116142714_create_users.rb b/db/migrate/20150116142714_create_users.rb index abc1234..def5678 100644 --- a/db/migrate/20150116142714_create_users.rb +++ b/db/migrate/20150116142714_create_users.rb @@ -4,6 +4,7 @@ t.string :name t.integer :age t.string :gender + t.string :orientation t.string :location t.string :password_digest t.string :email
Add column for sexual orientation to user table.
diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index abc1234..def5678 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -19,4 +19,4 @@ url: "/system/:rails_env/:class/:attachment/:id/:fingerprint.:extension" } -PAPERCLIP_FILE_MAX_SIZE = 25.megabytes +PAPERCLIP_FILE_MAX_SIZE = 75.megabytes
Increase max file size to 75 mb
diff --git a/lib/syncer/commands/syncer.rb b/lib/syncer/commands/syncer.rb index abc1234..def5678 100644 --- a/lib/syncer/commands/syncer.rb +++ b/lib/syncer/commands/syncer.rb @@ -10,7 +10,7 @@ def execute with_target_vms do |machine| machine = Machine.new(machine) - machine.full_sync + # machine.full_sync machine.listen end 0
Disable full sync for now as Vagrant already does this See https://github.com/asyrjasalo/vagrant-syncer/issues/6 for improvements.
diff --git a/resources/default.rb b/resources/default.rb index abc1234..def5678 100644 --- a/resources/default.rb +++ b/resources/default.rb @@ -15,7 +15,7 @@ attribute :path, :name_attribute => true, :kind_of => String, :required => true attribute :user , :kind_of => String -attribute :group , :kind_of => String, :default => nil +attribute :group , :kind_of => [ String, nil ], :default => nil attribute :read , :kind_of => [ TrueClass, FalseClass ], :default => true attribute :write , :kind_of => [ TrueClass, FalseClass ], :default => false attribute :execute , :kind_of => [ TrueClass, FalseClass ], :default => true
Add explicit nil handling for group to keep Chef Client happy, re ... group nil currently does not overwrite the value of group. This will change in Chef 13, and the value will be set to nil instead. Please change your code to explicitly accept nil using "property :group, [MyType, nil]", or stop setting this value to nil. at 1 location: - /var/chef/cache/cookbooks/posix_acl/providers/default.rb:63:in `load_current_resource'
diff --git a/test/csvconverter/commands/test_command_csv2strings.rb b/test/csvconverter/commands/test_command_csv2strings.rb index abc1234..def5678 100644 --- a/test/csvconverter/commands/test_command_csv2strings.rb +++ b/test/csvconverter/commands/test_command_csv2strings.rb @@ -32,5 +32,15 @@ system("rm -rf ./mynewlocation") end +def test_csv2strings_with_fetch_google_doc + options = { + :filename => "my_trads", + :langs => {"English" => "en", "French" => "fr"}, + :fetch => true + } + assert_nothing_raised do + CSV2StringsCommand.new([], options).csv2strings + end + end end
ADD command test for google_doc Does not fail because of require of test_helper
diff --git a/test/dummy/spec/models/has_and_belongs_to_many_spec.rb b/test/dummy/spec/models/has_and_belongs_to_many_spec.rb index abc1234..def5678 100644 --- a/test/dummy/spec/models/has_and_belongs_to_many_spec.rb +++ b/test/dummy/spec/models/has_and_belongs_to_many_spec.rb @@ -5,18 +5,24 @@ let(:part_1) { Part.create(part_number: "1234") } let(:part_2) { Part.create(part_number: "5678") } - before do - assembly.parts = [part_1, part_2] - end + describe ".cached_part_ids" do + it "returns an empty array when there are no parts" do + assembly.cached_part_ids.should == [] + end - describe ".cached_part_ids" do it "returns an array of parts ids" do + assembly.parts = [part_1, part_2] assembly.cached_part_ids.should == [part_1.id, part_2.id] end end describe ".cached_parts" do + it "returns an empty array when there are no parts" do + assembly.parts.should == [] + end + it "returns an array of parts" do + assembly.parts = [part_1, part_2] assembly.cached_parts.should == [part_1, part_2] end end
Add a few more tests
diff --git a/parse_fasta.gemspec b/parse_fasta.gemspec index abc1234..def5678 100644 --- a/parse_fasta.gemspec +++ b/parse_fasta.gemspec @@ -18,6 +18,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.required_ruby_version = ">= 2.0" + spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake", "~> 10.3" spec.add_development_dependency "rspec", "~> 2.14"
Add ruby version to gemspec
diff --git a/roles/web-backend.rb b/roles/web-backend.rb index abc1234..def5678 100644 --- a/roles/web-backend.rb +++ b/roles/web-backend.rb @@ -9,7 +9,7 @@ } }, :memcached => { - :memory_limit => 512 + :memory_limit => 4096 }, :web => { :rails_daemon_limit => 12,
Increase the size of the memcache store on the web backends
diff --git a/spec/controllers/people_controller_spec.rb b/spec/controllers/people_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/people_controller_spec.rb +++ b/spec/controllers/people_controller_spec.rb @@ -6,7 +6,7 @@ describe "#create" do it "should tell ASI to skip welcome mail if that's in the community's settings" do - PersonConnection.should_receive(:create_person).with(hash_including({:welcome_mail => false}), anything()).and_return({"entry" => {"id" => "dfskh3r29wefhsdifh"}}) + PersonConnection.should_receive(:create_person).with(hash_including({:welcome_email => false}), anything()).and_return({"entry" => {"id" => "dfskh3r29wefhsdifh"}}) @request.host = "test2.lvh.me" username = generate_random_username @@ -15,7 +15,7 @@ it "should tell ASI to send welcome mail if that's in the community's settings" do - PersonConnection.should_receive(:create_person).with(hash_including({:welcome_mail => true}), anything()).and_return({"entry" => {"id" => "dfskh3r29wefhsdifh"}}) + PersonConnection.should_receive(:create_person).with(hash_including({:welcome_email => true}), anything()).and_return({"entry" => {"id" => "dfskh3r29wefhsdifh"}}) @request.host = "test.lvh.me" username = generate_random_username
Fix to the typo in people controller spec tests
diff --git a/spec/controllers/queues_controller_spec.rb b/spec/controllers/queues_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/queues_controller_spec.rb +++ b/spec/controllers/queues_controller_spec.rb @@ -1,23 +1,13 @@ require 'spec_helper' describe QueuesController, :type => :controller do - before do - # TODO shouldn't this use the actual output of the json rendering? - repository = { 'id' => 8, 'slug' => 'svenfuchs/gem-release' } - build_3 = { 'id' => 1, 'number' => '3', 'commit' => 'b0a1b69', 'config' => {} } - build_31 = { 'id' => 2, 'number' => '3.1', 'commit' => 'b0a1b69', 'config' => {} } - end - - subject do - get :index, :format => :json - ActiveSupport::JSON.decode(response.body) - end + let(:jobs) { [Factory.create(:test, :number => '3'), Factory.create(:test, :number => '3.1') ] } it 'index lists all jobs on the queue' do - pending - should == [ - { 'id' => 1, 'number' => '3', 'commit' => 'b0a1b69', 'repository' => { 'id' => 8, 'slug' => 'svenfuchs/gem-release' } }, - { 'id' => 2, 'number' => '3.1', 'commit' => 'b0a1b69', 'repository' => { 'id' => 8, 'slug' => 'svenfuchs/gem-release' } }, - ] + get :index, :format => :json + + json = ActiveSupport::JSON.decode(response.body) + json.should include({ 'id' => jobs.first.id, 'number' => '3', 'commit' => '62aae5f70ceee39123ef', 'repository' => { 'id' => jobs.first.repository.id, 'slug' => 'svenfuchs/repository-1' } }) + json.should include({ 'id' => jobs.second.id, 'number' => '3.1', 'commit' => '62aae5f70ceee39123ef', 'repository' => { 'id' => jobs.second.repository.id, 'slug' => 'svenfuchs/repository-2' } }) end end
Use state :created instead of :started for selecting queued jobs
diff --git a/simple_form.gemspec b/simple_form.gemspec index abc1234..def5678 100644 --- a/simple_form.gemspec +++ b/simple_form.gemspec @@ -20,6 +20,6 @@ s.rubyforge_project = "simple_form" - s.add_dependency('activemodel', '~> 4.0') - s.add_dependency('actionpack', '~> 4.0') + s.add_dependency('activemodel', '>= 4.0') + s.add_dependency('actionpack', '>= 4.0') end
Update gem dependency to support rails 5 alpha
diff --git a/config/initializers/new_framework_defaults_6_0.rb b/config/initializers/new_framework_defaults_6_0.rb index abc1234..def5678 100644 --- a/config/initializers/new_framework_defaults_6_0.rb +++ b/config/initializers/new_framework_defaults_6_0.rb @@ -0,0 +1,44 @@+# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 6.0 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# see https://guides.rubyonrails.org/autoloading_and_reloading_constants.html +# There is a separate ticket to handle upgrade to zeitwork, we should stick +# to :classic for the time being. +# Rails.application.config.autoloader = :zeitwerk + +# Determines whether forms are generated with a hidden tag that forces older versions of Internet Explorer to submit forms encoded in UTF-8. +# Rails.application.config.action_view.default_enforce_utf8 = false + +# Embed purpose and expiry metadata inside signed and encrypted +# cookies for increased security. +# +# This option is not backwards compatible with earlier Rails versions. +# It's best enabled when your entire app is migrated and stable on 6.0. +# Rails.application.config.action_dispatch.use_cookies_with_metadata = true + +# Send Active Storage analysis and purge jobs to dedicated queues. +# Rails.application.config.active_storage.queues.analysis = :active_storage_analysis +# Rails.application.config.active_storage.queues.purge = :active_storage_purge + +# When assigning to a collection of attachments declared via `has_many_attached`, replace existing +# attachments instead of appending. Use #attach to add new attachments without replacing existing ones. +# Rails.application.config.active_storage.replace_on_assign_to_many = true + +# Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail. +# +# The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob), +# will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions. +# If you send mail in the background, job workers need to have a copy of +# MailDeliveryJob to ensure all delivery jobs are processed properly. +# Make sure your entire app is migrated and stable on 6.0 before using this setting. +# Rails.application.config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob" + +# Enable the same cache key to be reused when the object being cached of type +# `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count) +# of the relation's cache key into the cache version to support recycling cache key. +# Rails.application.config.active_record.collection_cache_versioning = true
Add rails 6.0 defaults file To be implemented/uncommented or not in subsequent individual PRs.
diff --git a/lib/post.rb b/lib/post.rb index abc1234..def5678 100644 --- a/lib/post.rb +++ b/lib/post.rb @@ -14,6 +14,14 @@ text = card.desc md_to_html(text) end + + def attachment + attachment = card.attachments.first + if (attachment.nil?) + return nil + end + card.attachments.first.attributes[:url] # Any attachments are hosted by trello + end def sponsored? card.labels.any? { |label| label.name == "Sponsored" }
Add method to get attachment from card This method will get the url attached to a card. If there's no attachment then it will return nil and the html generator will handle that situation.
diff --git a/spec/python-requirements_spec.rb b/spec/python-requirements_spec.rb index abc1234..def5678 100644 --- a/spec/python-requirements_spec.rb +++ b/spec/python-requirements_spec.rb @@ -4,7 +4,7 @@ it { should be_installed } end -describe package('python-dev'), :if => os[:family] == 'debian' do +describe package('python-dev'), :if => ['debian', 'alpine'].include?(os[:family]) do it { should be_installed } end @@ -12,7 +12,15 @@ it { should be_installed } end -describe package('unzip'), :if => os[:family] == 'debian' do +describe package('build-base'), :if => os[:family] == 'alpine' do + it { should be_installed } +end + +describe package('unzip'), :if => ['debian', 'alpine'].include?(os[:family]) do + it { should be_installed } +end + +describe package('curl'), :if => ['debian', 'alpine'].include?(os[:family]) do it { should be_installed } end
Update specs for Alpine Linux.
diff --git a/db/migrate/20130108123111_move_user_id_to_post.rb b/db/migrate/20130108123111_move_user_id_to_post.rb index abc1234..def5678 100644 --- a/db/migrate/20130108123111_move_user_id_to_post.rb +++ b/db/migrate/20130108123111_move_user_id_to_post.rb @@ -1,6 +1,5 @@ class MoveUserIdToPost < ActiveRecord::Migration class Monologue::PostsRevision < ActiveRecord::Base - attr_accessible :title, :content, :url, :published_at, :post_id end class Monologue::Post < ActiveRecord::Base
Remove usage of attr_accessible in migration
diff --git a/cookbooks/ssl/recipes/default.rb b/cookbooks/ssl/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/ssl/recipes/default.rb +++ b/cookbooks/ssl/recipes/default.rb @@ -28,13 +28,3 @@ backup false end end - -["openstreetmap", "tile.openstreetmap", "osmfoundation", "rapidssl", "startcom"].each do |certificate| - file "/etc/ssl/certs/#{certificate}.pem" do - action :delete - end - - file "/etc/ssl/private/#{certificate}.key" do - action :delete - end -end
Remove last traces of legacy certificate support
diff --git a/kuniri.gemspec b/kuniri.gemspec index abc1234..def5678 100644 --- a/kuniri.gemspec +++ b/kuniri.gemspec @@ -11,13 +11,13 @@ spec.summary = %q{Extract class information from code.} spec.description = %q{Extract class information from code.} spec.homepage = "" - spec.license = "MIT" + spec.license = "" spec.files = `git ls-files -z`.split("\x0") spec.executables = ["kuniri"] spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_development_dependency "bundler", "~> 1.7" + spec.add_development_dependency "bundler" spec.add_development_dependency "rake", "~> 10.0" end
Update gemspec, might fix travis error
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -3,6 +3,6 @@ def signup_email(user) @user = user - mail(:to => user.email, :subject => "Your Mini Video-ecourse") + mail(:to => user.email, :subject => "Your Mini Video-eCourse") end end
Tweak to user mailer subject line
diff --git a/spec/unit/default_spec.rb b/spec/unit/default_spec.rb index abc1234..def5678 100644 --- a/spec/unit/default_spec.rb +++ b/spec/unit/default_spec.rb @@ -8,7 +8,7 @@ end it 'converges successfully' do - expect { :chef_run }.to_not raise_error + expect { chef_run }.to_not raise_error end end @@ -20,7 +20,7 @@ end it 'converges successfully' do - expect { :chef_run }.to_not raise_error + expect { chef_run }.to_not raise_error end end end
Fix default spec to actually perform a chef run The former code was just testing the evaluation of :chef_run symbol.
diff --git a/app/services/deal_cards.rb b/app/services/deal_cards.rb index abc1234..def5678 100644 --- a/app/services/deal_cards.rb +++ b/app/services/deal_cards.rb @@ -1,6 +1,4 @@ class DealCards - attr_reader :errors - def initialize(round, deck) @round = round @game = round.game @@ -12,13 +10,13 @@ deal_cards if cards_can_be_dealt end - success? + @round.cards.present? end private def cards_can_be_dealt - @round.cards.count == 0 + @round.cards.none? end def deal_cards @@ -34,10 +32,7 @@ player.cards << card - # TODO for the whole service, just call save.bang! - don't worry about errors - unless card.save - add_error("unable to deal card: #{card.rank} of #{card.suit} to #{player.handle}") - end + card.save! end end end @@ -46,17 +41,7 @@ @deck.each do |card| card.round = @round - unless card.save - add_error("unable to deal card: #{card.rank} of #{card.suit} to the kitty") - end + card.save! end end - - def success? - @round.errors.empty? - end - - def add_error(message) - @errors << message - end end
Use save! in deal_card service instead of errors
diff --git a/lib/travis/build/appliances/show_system_info.rb b/lib/travis/build/appliances/show_system_info.rb index abc1234..def5678 100644 --- a/lib/travis/build/appliances/show_system_info.rb +++ b/lib/travis/build/appliances/show_system_info.rb @@ -24,6 +24,7 @@ end sh.echo "Build id: #{Shellwords.escape(data.build[:id])}" sh.echo "Job id: #{Shellwords.escape(data.job[:id])}" + sh.echo "Runtime kernel version: #{`uname -r`.strip}" end def show_travis_build_version
Add runtime kernel version to system info fold
diff --git a/lib/veritas/sql/compiler/generator/attribute.rb b/lib/veritas/sql/compiler/generator/attribute.rb index abc1234..def5678 100644 --- a/lib/veritas/sql/compiler/generator/attribute.rb +++ b/lib/veritas/sql/compiler/generator/attribute.rb @@ -7,8 +7,6 @@ module Attribute include Identifier - DOT = '.'.freeze - # Visit an Attribute # # @param [Attribute] attribute @@ -17,7 +15,7 @@ # # @api private def visit_veritas_attribute(attribute) - visit_identifier(@base_relation) << DOT << visit_identifier(attribute.name) + "#{visit_identifier(@base_relation)}.#{visit_identifier(attribute.name)}" end end # module Attribute
Update column SQL generation to match other code
diff --git a/some_html.gemspec b/some_html.gemspec index abc1234..def5678 100644 --- a/some_html.gemspec +++ b/some_html.gemspec @@ -18,5 +18,5 @@ s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"] s.test_files = Dir["test/**/*"] - s.add_dependency "rails", "~> 4.0.0" + s.add_dependency "rails", ">= 4.0.0" end
Update Gemspac for rails 4.1
diff --git a/forkit.gemspec b/forkit.gemspec index abc1234..def5678 100644 --- a/forkit.gemspec +++ b/forkit.gemspec @@ -2,7 +2,7 @@ lib = File.expand_path('../lib/', __FILE__) $:.unshift lib unless $:.include?(lib) -require "forkit" +require "forkit/version" Gem::Specification.new do |s| s.name = "forkit"
Update gemspec just to grab version
diff --git a/db/migrate/012_create_artists.rb b/db/migrate/012_create_artists.rb index abc1234..def5678 100644 --- a/db/migrate/012_create_artists.rb +++ b/db/migrate/012_create_artists.rb @@ -0,0 +1,19 @@+class CreateArtists < ActiveRecord::Migration[4.2] + def self.up + create_table :artists, id: :uuid, default: "uuid_generate_v4()", force: true do |t| + t.string :provider , null: false + t.string :identifier , null: false + t.string :url , null: false + t.string :name , null: false + t.string :thumbnail_url + t.string :artwork_url + + t.timestamps(null: false, default: -> { 'NOW()' }) + end + add_index :artists, [:provider, :identifier], unique: true + end + + def self.down + drop_table :artists + end +end
Add migration that create artists table
diff --git a/lib/ab/test.rb b/lib/ab/test.rb index abc1234..def5678 100644 --- a/lib/ab/test.rb +++ b/lib/ab/test.rb @@ -26,15 +26,22 @@ end def start_at - @start_at ||= hash['start_at'].nil? ? DateTime.new(0) : DateTime.parse(hash['start_at']) + @start_at ||= parse_time('start_at', 0) end def end_at - @end_at ||= hash['end_at'].nil? ? DateTime.new(3000) : DateTime.parse(hash['end_at']) + @end_at ||= parse_time('end_at', 3000) end def weight_sum variants.map(&:chance_weight).inject(:+) end + + private + + def parse_time(name, default) + value = hash[name] + value.nil? ? DateTime.new(default) : DateTime.parse(value) + end end end
Reduce duplication in Test class by extracting parse_time method
diff --git a/frontend/app/controllers/spree/products_controller.rb b/frontend/app/controllers/spree/products_controller.rb index abc1234..def5678 100644 --- a/frontend/app/controllers/spree/products_controller.rb +++ b/frontend/app/controllers/spree/products_controller.rb @@ -1,6 +1,8 @@ module Spree class ProductsController < Spree::StoreController before_filter :load_product, :only => :show + before_filter :load_taxon, :only => :index + rescue_from ActiveRecord::RecordNotFound, :with => :render_404 helper 'spree/taxons' @@ -31,5 +33,9 @@ end @product = @products.friendly.find(params[:id]) end + + def load_taxon + @taxon = Spree::Taxon.find(params[:taxon]) if params[:taxon].present? + end end end
[frontend] Load taxon if params[:taxon] exists in ProductsController Fixes a small bug where searching *twice* for the same term results in the taxon 'scope' being forgotten
diff --git a/lib/bluecap.rb b/lib/bluecap.rb index abc1234..def5678 100644 --- a/lib/bluecap.rb +++ b/lib/bluecap.rb @@ -10,8 +10,8 @@ require 'bluecap/handlers/attributes' require 'bluecap/handlers/event' require 'bluecap/handlers/identify' +require 'bluecap/handlers/null_handler' require 'bluecap/handlers/report' -require 'bluecap/null_object' module Bluecap
Add null handler, replacing generic null object
diff --git a/examples/test.rb b/examples/test.rb index abc1234..def5678 100644 --- a/examples/test.rb +++ b/examples/test.rb @@ -35,7 +35,7 @@ end def likes_ice_cream? - rand(10) > 5 ? :mixeds : :hate + rand(10) > 5 ? :mixed : :hate end def exit_love @@ -45,4 +45,4 @@ def no_ice_cream rand(4) > 2 ? true : false end -end+end
Fix small typo in example
diff --git a/app/controllers/setup_custom_start_point_controller.rb b/app/controllers/setup_custom_start_point_controller.rb index abc1234..def5678 100644 --- a/app/controllers/setup_custom_start_point_controller.rb +++ b/app/controllers/setup_custom_start_point_controller.rb @@ -11,13 +11,17 @@ def save_individual manifest = starter_manifest kata = katas.new_kata(manifest) # TODO: rescue SaverService::Error - redirect_to "/kata/edit/#{kata.id}" + respond_to do |format| + format.html { redirect_to "/kata/edit/#{kata.id}" } + end end def save_group manifest = starter_manifest group = groups.new_group(manifest) - redirect_to "/kata/group/#{group.id}" + respond_to do |format| + format.html { redirect_to "/kata/group/#{group.id}" } + end end private
Add format.html guards to setup-custom-start-point controller
diff --git a/write_now/db/migrate/20141013213639_create_users.rb b/write_now/db/migrate/20141013213639_create_users.rb index abc1234..def5678 100644 --- a/write_now/db/migrate/20141013213639_create_users.rb +++ b/write_now/db/migrate/20141013213639_create_users.rb @@ -1,6 +1,9 @@ class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| + t.string :name + t.string :password + t.timestamps end end end
Update user migration with string fields name and password.
diff --git a/spec/classes/glance_spec.rb b/spec/classes/glance_spec.rb index abc1234..def5678 100644 --- a/spec/classes/glance_spec.rb +++ b/spec/classes/glance_spec.rb @@ -23,7 +23,7 @@ it { should contain_file('/etc/glance/').with( 'ensure' => 'directory', 'owner' => 'glance', - 'mode' => '770', + 'mode' => '0770', 'require' => 'Package[glance]' )} end
Update unit test to reflect mode change The modes in the files have been updated to use the recommended 4 digit version. This commit updates the rspec tests to reflect this.
diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb index abc1234..def5678 100644 --- a/spec/models/comment_spec.rb +++ b/spec/models/comment_spec.rb @@ -1,5 +1,28 @@ require 'rails_helper' RSpec.describe Comment, type: :model do + let(:comment) { Comment.new(content: 'I am a comment', + user_id: User.first.id, + review_id: Review.first.id) } + describe 'validations' do + it 'is valid with valid attributes' do + expect(comment).to be_valid + end + + it 'is not valid without content' do + comment.content = '' + expect(comment).to_not be_valid + end + + it 'is not valid without a user id' do + comment.user_id = nil + expect(comment).to_not be_valid + end + + it 'is not valid with a review id' do + comment.review_id = nil + expect(comment).to_not be_valid + end + end end
Add validation tests to Comment model spec
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,7 +1,7 @@ name 'chef-vault' maintainer 'Chef Software, Inc.' maintainer_email 'cookbooks@chef.io' -license 'Apache 2.0' +license 'Apache-2.0' description 'Installs the chef-vault gem and provides chef_vault_item recipe helper' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '2.1.1'
Use a SPDX standard license string Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,9 +4,9 @@ license 'Apache 2.0' description 'Installs/Configures automount' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '0.2.2' -source_url 'https://github.com/datacoda/chef-automount' -issues_url 'https://github.com/datacoda/chef-automount/issues' +version '0.2.3' +source_url 'https://github.com/datacoda/chef-automount' if respond_to?(:source_url) +issues_url 'https://github.com/datacoda/chef-automount/issues' if respond_to?(:issues_url) %w(ubuntu).each do |os| supports os
Make compatible with Chef 11
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ source_url 'https://github.com/osuosl-cookbooks/yum-osuosl' issues_url 'https://github.com/osuosl-cookbooks/yum-osuosl/issues' license 'Apache-2.0' -chef_version '>= 14.0' +chef_version '>= 16.0' description 'Installs/Configures yum-osuosl' version '1.2.0'
Update Chef dependency to >= 16
diff --git a/metadata.rb b/metadata.rb index abc1234..def5678 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '4.2.2' -%w(ubuntu debian centos redhat amazon scientific fedora oracle opensuse opensuseleap freebsd windows zlinux).each do |os| +%w(ubuntu debian centos redhat amazon scientific fedora oracle suse opensuse opensuseleap freebsd windows zlinux).each do |os| supports os end
Add suse as a supported platform Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/week-6/bingo-solution.rb b/week-6/bingo-solution.rb index abc1234..def5678 100644 --- a/week-6/bingo-solution.rb +++ b/week-6/bingo-solution.rb @@ -0,0 +1,50 @@+# A Nested Array to Model a Bingo Board SOLO CHALLENGE + +# I spent [#] hours on this challenge. + + +# Release 0: Pseudocode +# Outline: + +# Create a method to generate a letter ( b, i, n, g, o) and a number (1-100) + #fill in the outline here + +# Check the called column for the number called. + #fill in the outline here + +# If the number is in the column, replace with an 'x' + #fill in the outline here + +# Display a column to the console + #fill in the outline here + +# Display the board to the console (prettily) + #fill in the outline here + +# Initial Solution + +class BingoBoard + + def initialize(board) + @bingo_board = board + end + + +end + +# Refactored Solution + + + +#DRIVER CODE (I.E. METHOD CALLS) GO BELOW THIS LINE +board = [[47, 44, 71, 8, 88], + [22, 69, 75, 65, 73], + [83, 85, 97, 89, 57], + [25, 31, 96, 68, 51], + [75, 70, 54, 80, 83]] + +new_game = BingoBoard.new(board) + + +#Reflection +
Add file for solo challenge 6.6
diff --git a/github-sync/user_mapping/user_emails.rb b/github-sync/user_mapping/user_emails.rb index abc1234..def5678 100644 --- a/github-sync/user_mapping/user_emails.rb +++ b/github-sync/user_mapping/user_emails.rb @@ -1,3 +1,3 @@ USER_EMAILS = { - 'github-login' => 'email@example.com' +# 'github-login' => 'email@example.com' }
Comment out the example line :)
diff --git a/wordpress_client.gemspec b/wordpress_client.gemspec index abc1234..def5678 100644 --- a/wordpress_client.gemspec +++ b/wordpress_client.gemspec @@ -1,21 +1,20 @@-# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'wordpress_client/version' Gem::Specification.new do |spec| - spec.name = "wordpress_client" - spec.version = WordpressClient::VERSION - spec.authors = ["Magnus Bergmark", "Rebecca Meritz"] - spec.email = ["magnus.bergmark@gmail.com", "rebecca@meritz.com"] - spec.summary = "A simple client to the Wordpress API." - spec.description = "A simple client to the Wordpress API." - spec.homepage = "" - spec.license = "MIT" + spec.name = "wordpress_client" + spec.version = WordpressClient::VERSION + spec.authors = ["Magnus Bergmark", "Rebecca Meritz", "Hans Maaherra"] + spec.email = ["magnus.bergmark@gmail.com", "rebecca@meritz.com", "hans.maaherra@gmail.com"] + spec.summary = "A simple client to the Wordpress API." + spec.description = "A simple client to the Wordpress API." + spec.homepage = "" + spec.license = "MIT" - spec.files = `git ls-files -z`.split("\x0") - spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) + spec.files = `git ls-files -z`.split("\x0") + spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } + spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_dependency "faraday", "~> 0.9"
Add Hans Maaherra as author of gem CC @hansmaaherra
diff --git a/spec/lib/tasks/dev_seed_spec.rb b/spec/lib/tasks/dev_seed_spec.rb index abc1234..def5678 100644 --- a/spec/lib/tasks/dev_seed_spec.rb +++ b/spec/lib/tasks/dev_seed_spec.rb @@ -0,0 +1,18 @@+require 'rails_helper' +require 'rake' + +describe 'rake db:dev_seed' do + before do + Rake.application.rake_require('tasks/db') + Rake::Task.define_task(:environment) + end + + let :run_rake_task do + Rake::Task['db:dev_seed'].reenable + Rake.application.invoke_task('db:dev_seed') + end + + it 'seeds the database without errors' do + expect { run_rake_task }.to_not raise_error + end +end
Add spec for 'rake db:dev_seed' task
diff --git a/db/migrate/20150608190551_add_boolean_to_settings.rb b/db/migrate/20150608190551_add_boolean_to_settings.rb index abc1234..def5678 100644 --- a/db/migrate/20150608190551_add_boolean_to_settings.rb +++ b/db/migrate/20150608190551_add_boolean_to_settings.rb @@ -1,6 +1,6 @@ class AddBooleanToSettings < ActiveRecord::Migration def change - add_column :settings, :show_breadcrumb, :boolean, default: 0, after: :show_map - add_column :settings, :show_social, :boolean, default: 1, after: :show_breadcrumb + add_column :settings, :show_breadcrumb, :boolean, default: false, after: :show_map + add_column :settings, :show_social, :boolean, default: true, after: :show_breadcrumb end end
Fix bug with boolean and postgre
diff --git a/AutoLayoutBuilder.podspec b/AutoLayoutBuilder.podspec index abc1234..def5678 100644 --- a/AutoLayoutBuilder.podspec +++ b/AutoLayoutBuilder.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "AutoLayoutBuilder" - s.version = "3.0.0" + s.version = "2.0.0" s.license = "MIT" s.summary = "Create adaptive layouts with an expressive yet concise syntax." s.homepage = "https://github.com/marcbaldwin/AutoLayoutBuilder"
Update podspec version to 2.0.0
diff --git a/app/models/miq_provision_configured_system_request.rb b/app/models/miq_provision_configured_system_request.rb index abc1234..def5678 100644 --- a/app/models/miq_provision_configured_system_request.rb +++ b/app/models/miq_provision_configured_system_request.rb @@ -25,6 +25,10 @@ 'ems_operations' end + def my_queue_name + src_configured_systems.first&.manager&.queue_name_for_ems_operations + end + def self.request_task_class_from(_attribs) ManageIQ::Providers::Foreman::ConfigurationManager::ProvisionTask end
Set my_queue_name for configured_system provisions
diff --git a/routes/routes.rb b/routes/routes.rb index abc1234..def5678 100644 --- a/routes/routes.rb +++ b/routes/routes.rb @@ -4,6 +4,7 @@ end get '/' do + Rollbar.error("Some error") haml :index end
Add temporary Rollbar error to index
diff --git a/templates/mongoid/features/step_definitions/mongoid_steps.rb b/templates/mongoid/features/step_definitions/mongoid_steps.rb index abc1234..def5678 100644 --- a/templates/mongoid/features/step_definitions/mongoid_steps.rb +++ b/templates/mongoid/features/step_definitions/mongoid_steps.rb @@ -1,3 +1,4 @@-Given /^an (.+) exists with an? (.+) of "([^"]*)"$/ do |model, field, value| - Factory model, field => value +Given /^an? (.+) exists with an? (.+) of "([^"]*)"$/ do |model, field, value| + factory_name = model.gsub(' ', '_') + Factory factory_name, field => value end
Update mongoid step definition to match Factory girl naming of model for steps
diff --git a/lib/mathmagic.rb b/lib/mathmagic.rb index abc1234..def5678 100644 --- a/lib/mathmagic.rb +++ b/lib/mathmagic.rb @@ -39,3 +39,6 @@ end end + +PI = Math::PI +E = Math::E
Add shortcuts to some constants
diff --git a/omniauth-khan-academy.gemspec b/omniauth-khan-academy.gemspec index abc1234..def5678 100644 --- a/omniauth-khan-academy.gemspec +++ b/omniauth-khan-academy.gemspec @@ -11,7 +11,7 @@ gem.add_runtime_dependency 'omniauth', '~> 1.0' gem.add_runtime_dependency 'oauth' gem.add_runtime_dependency 'multi_json' - gem.add_runtime_dependency 'active_support' + gem.add_runtime_dependency 'activesupport' gem.add_development_dependency 'rspec', '~> 2.7' gem.add_development_dependency 'pry'
Fix Rename active_support to activesupport in .gemspec
diff --git a/eligible.gemspec b/eligible.gemspec index abc1234..def5678 100644 --- a/eligible.gemspec +++ b/eligible.gemspec @@ -19,8 +19,7 @@ gem.add_dependency('rest-client', '~> 2.0.0') gem.add_dependency('multi_json', '~> 1.7') - gem.add_development_dependency('rake', '~> 10.5') + gem.add_development_dependency('rake', '~> 12.0') gem.add_development_dependency('rspec', '~> 3.4') - gem.add_development_dependency('rubocop', '= 0.35.0') gem.add_development_dependency('simplecov', '~> 0.11') end
Update rake version and remove rubocop dependency
diff --git a/test/integration/debian7_knife_bootstrap_test.rb b/test/integration/debian7_knife_bootstrap_test.rb index abc1234..def5678 100644 --- a/test/integration/debian7_knife_bootstrap_test.rb +++ b/test/integration/debian7_knife_bootstrap_test.rb @@ -6,7 +6,7 @@ end def image_id - "ami-51ff9238" + "ami-1d620e74" end def prepare_server
Update the Debian 7.0 AMI again The image was rebuilt.
diff --git a/app/controllers/simple_user/users/registrations_controller.rb b/app/controllers/simple_user/users/registrations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/simple_user/users/registrations_controller.rb +++ b/app/controllers/simple_user/users/registrations_controller.rb @@ -1,5 +1,14 @@ module SimpleUser class Users::RegistrationsController < Devise::RegistrationsController + def after_sign_up_path_for(resource) + if ENV['REDIRECT_USER_AFTER_SIGNIN'] == 'false' || !defined?(session[:return_to]) || session[:return_to] == "/" || session[:return_to].nil? + after_sign_in_path_for(resource) + else + return_to = session[:return_to] + return_to + end + end + end end
Change redirect after sign up
diff --git a/farm.gemspec b/farm.gemspec index abc1234..def5678 100644 --- a/farm.gemspec +++ b/farm.gemspec @@ -13,8 +13,8 @@ gem.files = %x{ git ls-files }.split("\n").select { |d| d =~ %r{^(README|lib/)} } - gem.add_dependency "json", "~> 1.6.5" - gem.add_dependency "rails", "~> 3.0" + gem.add_dependency "activesupport", "~> 3.0" + gem.add_dependency "json", "~> 1.6.5" gem.add_dependency "rake" - gem.add_dependency "rest-client", "~> 1.6.7" + gem.add_dependency "rest-client", "~> 1.6.7" end
Remove rails dependency add activesupport
diff --git a/lib/orderly.rb b/lib/orderly.rb index abc1234..def5678 100644 --- a/lib/orderly.rb +++ b/lib/orderly.rb @@ -5,7 +5,7 @@ RSpec::Matchers.define :appear_before do |later_content| match do |earlier_content| begin - node = page.current_scope + node = page.respond_to?(:current_scope) ? page.current_scope : page.send(:current_node) html = html_for_node(node) html.index(earlier_content) < html.index(later_content) rescue ArgumentError
Fix compatability with capybara 1.x
diff --git a/0_code_wars/7_down_arrow_with_numbers.rb b/0_code_wars/7_down_arrow_with_numbers.rb index abc1234..def5678 100644 --- a/0_code_wars/7_down_arrow_with_numbers.rb +++ b/0_code_wars/7_down_arrow_with_numbers.rb @@ -0,0 +1,27 @@+# http://www.codewars.com/kata/5645b24e802c6326f7000049/ +# iteration 1 +def get_a_down_arrow_of(n) + return "" if n < 1 + pad_l = (1...n).map{ |x| x % 10 }.join("") + pad_r = pad_l.reverse + result_arr = [] + n.downto(1).each do |i| + result_arr << "#{pad_l}#{i%10}#{pad_r}" + pad_l[-1], pad_r[0] = ["", ""] if pad_l.size > 0 + end + result_arr.map.with_index{ |x, i| " " * i << x }.join("\n") +end + +# iteration 2 +def get_a_down_arrow_of(n) + return "" unless n > 0 + + pad_l = Array.new(n-1){ |i| (i + 1) % 10 }.join("") + pad_r = pad_l.reverse + + n.downto(1).map.with_index do |x, i| + str = " " * i + "#{pad_l}#{x%10}#{pad_r}" + pad_l[-1], pad_r[0] = ["", ""] if pad_l.size > 0 + str + end.join("\n") +end
Add code wars (7) down arrow with numbers
diff --git a/lib/tito/base.rb b/lib/tito/base.rb index abc1234..def5678 100644 --- a/lib/tito/base.rb +++ b/lib/tito/base.rb @@ -1,7 +1,5 @@ module Tito class Base < JsonApiClient::Resource - # set the api base url in an abstract base class - # self.site = "https://api.tito.io/v2" - self.site = "http://api.tito.dev/v2" + self.site = ENV['TITO_SITE'] || "https://api.tito.io/v2" end end
Allow setting the site via ENV var
diff --git a/extras/sanitizable_attributes.rb b/extras/sanitizable_attributes.rb index abc1234..def5678 100644 --- a/extras/sanitizable_attributes.rb +++ b/extras/sanitizable_attributes.rb @@ -2,18 +2,28 @@ # # Usage in model: # -# sanitize_attributes :description, :documentation_description -# -# For now it just allows defaults, mainly harmless formatting tags, see ActionView::Base.sanitized_allowed_tags -# and ActionView::Base.sanitized_allowed_attributes for whole list. +# sanitize_attributes :description, :documentation_description +# module SanitizableAttributes + # based on defaults from ActionView::Base.sanitized_allowed_tags with table tags added + SANITIZED_ALLOWED_TAGS = %w(strong em b i p code pre tt samp kbd var sub sup dfn cite big small + address hr br div span h1 h2 h3 h4 h5 h6 ul ol li dl dt dd abbr acronym a img blockquote del ins + table tr td th) + + # based on defaults from ActionView::Base.sanitized_allowed_attributes + SANITIZED_ALLOWED_ATTRIBUTES = %w(href src width height alt cite datetime title class name xml:lang abbr) + def self.included(model) model.extend(ClassMethods) end def sanitize! self.class.sanitizable_attributes.each do |attr_name| - sanitized_value = ActionController::Base.helpers.sanitize(self.send("#{attr_name}")) + sanitized_value = ActionController::Base.helpers.sanitize(self.send("#{attr_name}"), + :tags => SANITIZED_ALLOWED_TAGS, + :attributes => SANITIZED_ALLOWED_ATTRIBUTES + ) + self.send("#{attr_name}=", sanitized_value) end end
Add table tags to list of allowable tags for sanitize. Implement formatable descriptions [story: #40582233]
diff --git a/authentication/lib/refinerycms-authentication.rb b/authentication/lib/refinerycms-authentication.rb index abc1234..def5678 100644 --- a/authentication/lib/refinerycms-authentication.rb +++ b/authentication/lib/refinerycms-authentication.rb @@ -1,13 +1,6 @@ require 'devise' require 'refinerycms-core' require 'friendly_id' -# Attach authenticated system methods to the ::Refinery::ApplicationController -require File.expand_path('../authenticated_system', __FILE__) -[::Refinery::ApplicationController, ::Refinery::ApplicationHelper].each do |c| - c.class_eval { - include AuthenticatedSystem - } -end module Refinery module Authentication @@ -32,6 +25,13 @@ plugin.url = {:controller => '/admin/users'} end end + + refinery.before_inclusion do + [::Refinery::ApplicationController, ::Refinery::ApplicationHelper].each do |c| + c.send :require, File.expand_path('../authenticated_system', __FILE__) + c.send :include, AuthenticatedSystem + end + end end class << self
Make better use of refinery.before_inclusion in the authentication engine.
diff --git a/lib/rack/oauth2/models/active_record.rb b/lib/rack/oauth2/models/active_record.rb index abc1234..def5678 100644 --- a/lib/rack/oauth2/models/active_record.rb +++ b/lib/rack/oauth2/models/active_record.rb @@ -5,6 +5,10 @@ module ActiveRecordExt def table_name "oauth2_provider_#{name.split("::").last.underscore}" + end + + def self.extended(mod) + mod.attr_protected if mod.respond_to?(:attr_protected) # protect nothing end end
Add blank attrib blacklist if protected_attributes gem is in use
diff --git a/cleaner.rb b/cleaner.rb index abc1234..def5678 100644 --- a/cleaner.rb +++ b/cleaner.rb @@ -1,14 +1,21 @@ class Cleaner def self.clean_folder path + dirty_folders = [] Dir.glob(path + "/**").sort.each do |file| - if File.file?(file) + if File.directory?(file) + self.clean_folder file + dirty_folders << file + else + puts 'cleaning file' + file self.rename_file file, path - else - puts file + " is a folder" - self.clean_folder file end end + + self.rename_folders dirty_folders, path "Cleaned files in folder: " + path + end + def self.rename_folders folders, path + folders.each{ |folder| self.rename_file folder, path } end def self.rename_file file, path filename = self.clean_file_name file
Add logic to rename folders and files
diff --git a/lex.gemspec b/lex.gemspec index abc1234..def5678 100644 --- a/lex.gemspec +++ b/lex.gemspec @@ -9,10 +9,12 @@ spec.email = ["me@piotrmurach.com"] spec.summary = %q{Lex is an implementation of complier constuction tool lex in Ruby.} spec.description = %q{Lex is an implementation of compiler construction tool lex in Ruby. The goal is to stay close to the way the original tool works and combine it with the expressivness or Ruby.} - spec.homepage = "" + spec.homepage = "https://github.com/piotrmurach/lex" spec.license = "MIT" - spec.files = `git ls-files -z`.split("\x0") + spec.files = Dir['{lib,spec,examples}/**/*.rb'] + spec.files += Dir['tasks/*', 'lex.gemspec'] + spec.files += Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt', 'Rakefile'] spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"]
Change to load files without git
diff --git a/lib/drs_core/datastreams/paranoid_rights_datastream.rb b/lib/drs_core/datastreams/paranoid_rights_datastream.rb index abc1234..def5678 100644 --- a/lib/drs_core/datastreams/paranoid_rights_datastream.rb +++ b/lib/drs_core/datastreams/paranoid_rights_datastream.rb @@ -3,7 +3,7 @@ use_terminology Hydra::Datastream::RightsMetadata VALIDATIONS = [ - {:key => :edit_users, :message => 'Depositor must have edit access', :condition => lambda { |obj| !obj.edit_users.include?(obj.depositor) }}, + {:key => :edit_users, :message => 'Depositor must have edit access', :condition => lambda { |obj| !obj.edit_users.include?(obj.properties.depositor.first) }}, {:key => :edit_groups, :message => 'Public cannot have edit access', :condition => lambda { |obj| obj.edit_groups.include?('public') }}, {:key => :edit_groups, :message => 'Registered cannot have edit access', :condition => lambda { |obj| obj.edit_groups.include?('registered') }} ]
Change paranoid rights datastream validations to only require that a properties datastream with depositor exist.
diff --git a/test/ruby/abstract_request_handler_spec.rb b/test/ruby/abstract_request_handler_spec.rb index abc1234..def5678 100644 --- a/test/ruby/abstract_request_handler_spec.rb +++ b/test/ruby/abstract_request_handler_spec.rb @@ -0,0 +1,45 @@+require 'support/config' +require 'support/test_helper' +require 'passenger/abstract_request_handler' + +include Passenger + +describe AbstractRequestHandler do + before :each do + @owner_pipe = IO.pipe + @request_handler = AbstractRequestHandler.new(@owner_pipe[1]) + def @request_handler.process_request(*args) + # Do nothing. + end + end + + after :each do + @request_handler.cleanup + @owner_pipe[0].close rescue nil + end + + it "exits if the owner pipe is closed" do + @request_handler.start_main_loop_thread + @owner_pipe[0].close + begin + Timeout.timeout(5) do + while @request_handler.main_loop_running? + sleep 0.01 + end + end + rescue Timeout::Error + violated + end + end + + it "ignores new connections that don't send any data" do + def @request_handler.accept_connection + return nil + end + @request_handler.start_main_loop_thread + while @request_handler.iterations == 0 + sleep 0.01 + end + @request_handler.processed_requests.should == 0 + end +end
Restructure AbstractRequestHandler so that it can be unit tested.