diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/models/railgun/asset.rb b/app/models/railgun/asset.rb index abc1234..def5678 100644 --- a/app/models/railgun/asset.rb +++ b/app/models/railgun/asset.rb @@ -16,7 +16,7 @@ def guess_caption self.caption = self.caption.presence - self.caption ||= File.basename(image.path, ".*").gsub("_", " ") + self.caption ||= File.basename(image.path, ".*").gsub("_", " ") if image.path end end
Handle nil image path when guessing caption
diff --git a/lib/formtastic-bootstrap/inputs/base/wrapping.rb b/lib/formtastic-bootstrap/inputs/base/wrapping.rb index abc1234..def5678 100644 --- a/lib/formtastic-bootstrap/inputs/base/wrapping.rb +++ b/lib/formtastic-bootstrap/inputs/base/wrapping.rb @@ -22,13 +22,16 @@ def control_group_wrapping(&block) template.content_tag(:div, - [template.capture(&block), error_html].join("\n").html_safe, + template.capture(&block).html_safe, wrapper_html_options ) end def controls_wrapping(&block) - template.content_tag(:div, template.capture(&block).html_safe, controls_wrapper_html_options) + template.content_tag(:div, + [template.capture(&block), error_html].join("\n").html_safe, + controls_wrapper_html_options + ) end def controls_wrapper_html_options
Move help-inline error sentences inside their control's div Issue #42, move the help-inline items to inside their control's div. Based on Twitter Bootstrap documentation
diff --git a/monaco.gemspec b/monaco.gemspec index abc1234..def5678 100644 --- a/monaco.gemspec +++ b/monaco.gemspec @@ -14,14 +14,6 @@ spec.homepage = "https://github.com/robmiller/monaco" spec.license = "MIT" - # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or - # delete this section to allow pushing this gem to any host. - if spec.respond_to?(:metadata) - spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'" - else - raise "RubyGems 2.0 or newer is required to protect against public gem pushes." - end - spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
Allow gem to be published anywhere
diff --git a/Casks/dhs.rb b/Casks/dhs.rb index abc1234..def5678 100644 --- a/Casks/dhs.rb +++ b/Casks/dhs.rb @@ -2,6 +2,7 @@ version '1.2.0' sha256 '8a9d15d5fd4cff113285fa53b2e4071fe9f7c9d2b8e7514f3ba907e657972405' + # bitbucket.org/objective-see was verified as official when first introduced to the cask url "https://bitbucket.org/objective-see/deploy/downloads/DHS_#{version}.zip" name 'Dylib Hijeck Scanner' homepage 'https://objective-see.com/products/dhs.html'
Fix `url` stanza comment for Dylib Hijeck Scanner.
diff --git a/gitback.rb b/gitback.rb index abc1234..def5678 100644 --- a/gitback.rb +++ b/gitback.rb @@ -8,7 +8,7 @@ username = "addyosmani" time = Time.new # feel free to comment out the option you don't wish to use. -backupDirectory = "/backups/github/#{time.year}.#{time.month}.#{time.day}" +backupDirectory = "~/backups/github/#{time.year}.#{time.month}.#{time.day}" #or simply: backupDirectory = "/backups/github/" #repositories = # .map{|r| %Q[#{r[:name]}] }
Put backups into home directory
diff --git a/base.rb b/base.rb index abc1234..def5678 100644 --- a/base.rb +++ b/base.rb @@ -1,14 +1,14 @@+project_name = @root.split('/').last +owner = `whoami` + # Delete unnecessary files run "rm README" run "rm -rf doc" run "rm public/index.html" run "rm public/favicon.ico" -# Set up git repository +# Set up git. git :init - -# Copy database.yml for distribution use -run "cp config/database.yml config/database.yml.example" file '.gitignore', <<-END .DS_Store @@ -16,7 +16,42 @@ *.sqlite3 log tmp -config/database.yml +END + +# Copy database.yml for distribution use +run "cp config/database.yml config/database.yml.example" + +file 'config/database.yml', <<-END +# gem install postgresql-ruby (not necessary on OS X Leopard) +development: + adapter: postgresql + database: #{project_name} + username: #{owner} + password: #{owner} + host: localhost + pool: 5 + timeout: 5000 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + adapter: postgresql + database: #{project_name}_test + username: #{owner} + password: #{owner} + host: localhost + pool: 5 + timeout: 5000 + +production: + adapter: postgresql + database: #{project_name} + username: #{owner} + password: #{owner} + host: localhost + pool: 5 + timeout: 5000 END # Install Rails plugins @@ -24,12 +59,13 @@ # Install all gems gem 'less' +gem 'mocha' +gem 'postgresql-ruby' gem 'shoulda' -gem 'mocha' rake 'gems:install', :sudo => true -# Commit all work so far to the repository +# Now commit everything. git :add => '.' git :commit => "-a -m 'Initial commit.'"
Set up PostgreSQL by default.
diff --git a/vgh.gemspec b/vgh.gemspec index abc1234..def5678 100644 --- a/vgh.gemspec +++ b/vgh.gemspec @@ -24,5 +24,4 @@ gem.add_development_dependency "rake" gem.add_development_dependency "yard" gem.add_development_dependency "bundle" - gem.add_development_dependency "bundler" end
Remove bundler from development dependencies Signed-off-by: Vlad <db4e71efac74cb2660ed39cb2c5b8af31d521746@vladgh.com>
diff --git a/spec/hoosegow_docker_spec.rb b/spec/hoosegow_docker_spec.rb index abc1234..def5678 100644 --- a/spec/hoosegow_docker_spec.rb +++ b/spec/hoosegow_docker_spec.rb @@ -0,0 +1,25 @@+require_relative '../lib/hoosegow/docker' + +describe Hoosegow::Docker do + context 'volumes' do + subject { described_class.new(:volumes => volumes) } + + context 'unspecified' do + subject { described_class.new } + its(:volumes_for_create) { should be_nil } + its(:volumes_for_bind) { should be_nil } + end + + context 'empty' do + let(:volumes) { {} } + its(:volumes_for_create) { should be_empty } + its(:volumes_for_bind) { should be_empty } + end + + context 'with volumes' do + let(:volumes) { {"/inside/path" => "/home/burke/data-for-container", "/other/path" => "/etc/shared-config"} } + its(:volumes_for_create) { should == {"/inside/path" => {}, "/other/path" => {}} } + its(:volumes_for_bind) { should == ["/home/burke/data-for-container:/inside/path:rw", "/etc/shared-config:/other/path:rw"] } + end + end +end
Add specs for volume transformations.
diff --git a/spec/rails_nlp/query_spec.rb b/spec/rails_nlp/query_spec.rb index abc1234..def5678 100644 --- a/spec/rails_nlp/query_spec.rb +++ b/spec/rails_nlp/query_spec.rb @@ -10,17 +10,17 @@ it "#keywords gives the query sanitized, with stopwords removed" do flexmock(RailsNlp).should_receive(:suggest_stopwords).and_return(["penguin"]) q = Query.new("a penguin is brown") - q.keywords.should eq("a is brown") + expect(q.keywords).to eq("a is brown") end it "#metaphones gives the keywords converted to metaphones" do q = Query.new("badger hole") - q.metaphones.should eq("PJR HL") + expect(q.metaphones).to eq("PJR HL") end it "#stems gives the stems of the keywords" do q = Query.new("switching bars") - q.stems.should eq("switch bar") + expect(q.stems).to eq("switch bar") end end end
Fix specs, new rspec syntax.
diff --git a/lib/raven/railtie.rb b/lib/raven/railtie.rb index abc1234..def5678 100644 --- a/lib/raven/railtie.rb +++ b/lib/raven/railtie.rb @@ -5,6 +5,13 @@ class Railtie < ::Rails::Railtie initializer "raven.use_rack_middleware" do |app| app.config.middleware.insert 0, "Raven::Rack" + end + + initializer 'raven.action_controller' do + ActiveSupport.on_load :action_controller do + require 'raven/rails/controller_methods' + include Raven::Rails::ControllerMethods + end end config.after_initialize do @@ -23,3 +30,4 @@ end end end +
Include Rails controller methods via Railtie See #85
diff --git a/lib/riif/dsl/vend.rb b/lib/riif/dsl/vend.rb index abc1234..def5678 100644 --- a/lib/riif/dsl/vend.rb +++ b/lib/riif/dsl/vend.rb @@ -30,8 +30,7 @@ :custfld5, :custfld6, :custfld7, - :"1099", - :note + :"1099" ] START_COLUMN = 'VEND' END_COLUMN = ''
Remove duplicate key 'note' in VEND object
diff --git a/lib/tasks/stats.rake b/lib/tasks/stats.rake index abc1234..def5678 100644 --- a/lib/tasks/stats.rake +++ b/lib/tasks/stats.rake @@ -0,0 +1,6 @@+desc "Sync steam stats for recently logged in users" +task :sync_stats => :environment do + Player.where(:last_viewed.gte => 1.week.ago).each do |player| + SteamApiService.new(player).download_player_stats + end +end
Add rake task for syncing all users
diff --git a/lib/truncate_html.rb b/lib/truncate_html.rb index abc1234..def5678 100644 --- a/lib/truncate_html.rb +++ b/lib/truncate_html.rb @@ -1,4 +1,5 @@ require File.join(File.dirname(__FILE__), 'truncate_html', 'html_truncator') +require File.join(File.dirname(__FILE__), 'truncate_html', 'html_string') require File.join(File.dirname(__FILE__), 'truncate_html', 'configuration') require File.join(File.dirname(__FILE__), 'app', 'helpers', 'truncate_html_helper')
Work around a failure to autoload classes in frozen gems in Rails 2.1 (and make load more robust) Signed-off-by: Harold Giménez <187218c0e52f01347631ac23e73c24fd2c2a5ba7@gmail.com>
diff --git a/lib/aptly_command.rb b/lib/aptly_command.rb index abc1234..def5678 100644 --- a/lib/aptly_command.rb +++ b/lib/aptly_command.rb @@ -24,6 +24,21 @@ @config[k.to_sym] = ask("Enter a value for #{k}:") elsif v == '${PROMPT_PASSWORD}' @config[k.to_sym] = password("Enter a value for #{k}:") + elsif v == '${KEYRING}' + require 'keyring' + + keyring = Keyring.new + value = keyring.get_password(@config[:server], @config[:username]) + + unless value + # Prompt for password... + value = password("Enter a value for #{k}:") + + # ... and store in keyring + keyring.set_password(@config[:server], @config[:username], value) + end + + @config[k.to_sym] = value end end
Use `keyring` gem when `${KEYRING}` specified Optionally use the [`keyring` gem](https://github.com/jheiss/keyring) when `${KEYRING}` is specified as a value for an option or config setting. Note that I require `keyring` at the point of use, so that it is an optional dependency.
diff --git a/lib/nacre/product.rb b/lib/nacre/product.rb index abc1234..def5678 100644 --- a/lib/nacre/product.rb +++ b/lib/nacre/product.rb @@ -49,7 +49,7 @@ def self.get(range) request_url = build_request_url(url,range,resource_options) response = self.link.get(request_url) - Nacre::Product.from_json(response.body) + self.from_json(response.body) end private
Use self instead of explicit class name
diff --git a/lib/output_helper.rb b/lib/output_helper.rb index abc1234..def5678 100644 --- a/lib/output_helper.rb +++ b/lib/output_helper.rb @@ -3,7 +3,7 @@ class OutputHelper def self.run - is_json_mode = (ENV['XSUB_JSON'] == '0') + is_json_mode = (ENV['XSUB_FORCE_JSON'] == '1') is_success = true if is_json_mode then
Change the force json mode enabling flag to XSUB_FORCE_JSON=1
diff --git a/lib/owners/config.rb b/lib/owners/config.rb index abc1234..def5678 100644 --- a/lib/owners/config.rb +++ b/lib/owners/config.rb @@ -39,8 +39,8 @@ end def subscribers(path, subscription) - subscribers, pattern = subscription.split(/\s+/, 2) - regex = Regexp.new(pattern || ".*") + subscribers, filter = subscription.split(/\s+/, 2) + regex = Regexp.new(filter || ".*") subscribers.split(",").tap do |owners| owners.clear unless regex =~ path
Rename a local variable for clarity
diff --git a/lib/voight_kampff.rb b/lib/voight_kampff.rb index abc1234..def5678 100644 --- a/lib/voight_kampff.rb +++ b/lib/voight_kampff.rb @@ -3,7 +3,7 @@ require 'voight_kampff/test' require 'voight_kampff/methods' require 'voight_kampff/rack_request' if defined?(Rack::Request) -require 'voight_kampff/engine' if defined?(Rails) +require 'voight_kampff/engine' if defined?(Rails::Engine) module VoightKampff class << self
Load engine if Rails::Engine defined
diff --git a/lib/data_kitten/publishing_formats.rb b/lib/data_kitten/publishing_formats.rb index abc1234..def5678 100644 --- a/lib/data_kitten/publishing_formats.rb +++ b/lib/data_kitten/publishing_formats.rb @@ -12,7 +12,10 @@ DataKitten::PublishingFormats::Datapackage, DataKitten::PublishingFormats::RDFa ].each do |format| - extend format if format.supported?(self) + if format.supported?(self) + extend format + break + end end end
Break from loop if format is supported
diff --git a/chef-berksfile-env.gemspec b/chef-berksfile-env.gemspec index abc1234..def5678 100644 --- a/chef-berksfile-env.gemspec +++ b/chef-berksfile-env.gemspec @@ -15,7 +15,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency "berkshelf", "~> 4.0" + spec.add_dependency "berkshelf", ">= 4.0", "< 6.0" spec.add_dependency "chef", ">= 11.0", "< 13.0" spec.add_development_dependency "bundler", "~> 1.6"
Allow berkshelf 5.0 in dependencies
diff --git a/lib/gerritfs/fs/file_with_comments.rb b/lib/gerritfs/fs/file_with_comments.rb index abc1234..def5678 100644 --- a/lib/gerritfs/fs/file_with_comments.rb +++ b/lib/gerritfs/fs/file_with_comments.rb @@ -38,7 +38,7 @@ comment_overlay = build_overlay @content.zip(comment_overlay).map do |l,cs| if cs then - [l] + cs + ["\n"] + [l] + cs else l end
Remove extra line at the end of comments
diff --git a/lib/poi2csv.rb b/lib/poi2csv.rb index abc1234..def5678 100644 --- a/lib/poi2csv.rb +++ b/lib/poi2csv.rb @@ -12,6 +12,10 @@ console_message = `java -cp #{classpath} ToCSV #{args * ' '}` raise Poi2csvException.new, console_message unless output_file_created?(input_file_path, output_folder_path) end + + def supports_extension?(extension) + SUPPORTED_EXTENSIONS.include?(extension) + end def self.classpath @_classpath ||= File.expand_path(File.join(File.dirname(__FILE__),'*')) + File::PATH_SEPARATOR + File.expand_path(File.join(File.dirname(__FILE__),'..', 'classes'))
Add method to check extension support
diff --git a/lib/chamber.rb b/lib/chamber.rb index abc1234..def5678 100644 --- a/lib/chamber.rb +++ b/lib/chamber.rb @@ -23,8 +23,12 @@ load_file(self.basepath + 'settings.yml') end - def [](key) - settings[key] + def method_missing(name, *args) + settings.public_send(name, *args) if settings.respond_to?(name) + end + + def respond_to_missing(name) + settings.respond_to?(name) end private
Use method missing to delegate any message sent to Chamber as a message for the underlying Hash
diff --git a/lib/dap/cli.rb b/lib/dap/cli.rb index abc1234..def5678 100644 --- a/lib/dap/cli.rb +++ b/lib/dap/cli.rb @@ -6,7 +6,7 @@ include RestCli def create_threat_assessment_run(name, section_ids, start_time, end_time) - puts "1. creating new experiment for #{section_ids} profiles with period #{start_time} - #{end_time}" + puts "1. creating new threat assessment run for #{section_ids} profiles with period #{start_time} - #{end_time}" response = connection.post do |req| req.url '/api/v1/threat_assessments' @@ -16,7 +16,6 @@ name: name, start_date: start_time, end_date: end_time, - section_ids: section_ids, status: :started } }.to_json @@ -27,11 +26,11 @@ JSON.parse(response.body)['threat_assessment']['id'] end - def update_threat_assessment_run(exp_id, updated_fields) - puts "Updating #{exp_id} experiment with following fields #{updated_fields}" + def update_threat_assessment_run(tar_id, updated_fields) + puts "Updating #{tar_id} threat assessment run with following fields #{updated_fields}" response = connection.put do |req| - req.url "/api/v1/threat_assessments/#{exp_id}" + req.url "/api/v1/threat_assessments/#{tar_id}" req.headers['Content-Type'] = 'application/json' req.body = { threat_assessment: updated_fields }.to_json end
Rename experiment to threat assessment run.
diff --git a/lib/redtape.rb b/lib/redtape.rb index abc1234..def5678 100644 --- a/lib/redtape.rb +++ b/lib/redtape.rb @@ -30,8 +30,8 @@ if model.invalid? own_your_errors_in(model) end - rescue MethodMissingError => e - fail MethodMissing Error, "#{self.class} is missing 'validates_and_saves :#{accessor}'" + rescue NoMethodError => e + fail NoMethodError, "#{self.class} is missing 'validates_and_saves :#{accessor}': #{e}" end end end
Fix exception handling for missing methods.
diff --git a/app/helpers/i18n_helper.rb b/app/helpers/i18n_helper.rb index abc1234..def5678 100644 --- a/app/helpers/i18n_helper.rb +++ b/app/helpers/i18n_helper.rb @@ -1,17 +1,17 @@ module I18nHelper def set_locale - # Save a given locale + # Save a given locale from params if params[:locale] && available_locale?(params[:locale]) spree_current_user&.update!(locale: params[:locale]) cookies[:locale] = params[:locale] end # After logging in, check if the user chose a locale before - if spree_current_user && spree_current_user.locale.nil? && cookies[:locale] - spree_current_user.update!(locale: params[:locale]) + if current_user_locale.nil? && cookies[:locale] + spree_current_user&.update!(locale: params[:locale]) end - I18n.locale = spree_current_user.andand.locale || cookies[:locale] || I18n.default_locale + I18n.locale = current_user_locale || cookies[:locale] || I18n.default_locale end def valid_locale(user) @@ -29,4 +29,8 @@ def available_locale?(locale) Rails.application.config.i18n.available_locales.include?(locale) end + + def current_user_locale + spree_current_user.andand.locale + end end
Refactor current_user_locale to a new method
diff --git a/app/helpers/orgs_helper.rb b/app/helpers/orgs_helper.rb index abc1234..def5678 100644 --- a/app/helpers/orgs_helper.rb +++ b/app/helpers/orgs_helper.rb @@ -9,9 +9,11 @@ # @return [String] The tooltip message def tooltip_for_org_feedback_form(org) email = org.contact_email.presence || DEFAULT_EMAIL - _("Someone will respond to your request within 48 hours. If you have \ - questions pertaining to this action please contact us at %{email}") % { - email: email + _("A data librarian from %{org_name} will respond to your request within 48 + hours. If you have questions pertaining to this action please contact us + at %{organisation_email}.") % { + organisation_email: email, + org_name: org.name } end end
Update feedback tooltip message in org feedback
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 @@ -9,8 +9,7 @@ @token = token @instance = Rails.configuration.x.local_domain - # I18n.with_locale(@resource.locale || I18n.default_locale) do - I18n.with_locale(:ja) do + I18n.with_locale(@resource.locale || I18n.default_locale) do mail to: @resource.unconfirmed_email.blank? ? @resource.email : @resource.unconfirmed_email, subject: I18n.t('devise.mailer.confirmation_instructions.subject', instance: @instance) end end
Revert "force mailer lang ja"
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 @@ -4,7 +4,7 @@ def user_created(user) @user = user @brand = brand_name - mail = mail(:to => @user.email, :subject => "Your account has been created for #{@brand}") do |format| + mail = mail(:to => @user.email, :subject => "Your account has been created for #{APP_CONFIG['brand']['site_name']}") do |format| format.html end @@ -28,7 +28,7 @@ @organization = organization @brand = brand_name @future_events = Event.live.where(["end_date >= ?", Date.today]) - mail = mail(:to => @user.email, :subject => "Welcome to #{organization.name}, a part of #{brand_name}") do |format| + mail = mail(:to => @user.email, :subject => "Welcome to #{organization.name}, a part of #{APP_CONFIG['brand']['site_name']}") do |format| format.html end
Remove formatted brand from email
diff --git a/app/models/nwmls/office.rb b/app/models/nwmls/office.rb index abc1234..def5678 100644 --- a/app/models/nwmls/office.rb +++ b/app/models/nwmls/office.rb @@ -18,4 +18,18 @@ @members ||= Nwmls::Member.find(:office_mls_id => office_mlsid) end + Nwmls::Listing::TYPE_TO_CLASS_MAP.each do |type, klass| + method_name = klass.demodulize.underscore.pluralize + define_method method_name do + unless instance_variable_get("@#{method_name}") + instance_variable_set("@#{method_name}", klass.constantize.find(:office_mls_id => office_mlsid, :property_type => type)) + end + instance_variable_get("@#{method_name}") + end + end + + def listings + @listings ||= Nwmls::Listing::TYPE_TO_CLASS_MAP.collect { |type, klass| public_send(klass.demodulize.underscore.pluralize) }.sum + end + end
ADD listing method for Office
diff --git a/lib/schnitzelpress/cli.rb b/lib/schnitzelpress/cli.rb index abc1234..def5678 100644 --- a/lib/schnitzelpress/cli.rb +++ b/lib/schnitzelpress/cli.rb @@ -40,20 +40,14 @@ desc "mongo_pull", "Pulls contents of remote MongoDB into your local MongoDB" def mongo_pull - if uri = YAML.load_file('./config/mongo.yml')['development']['uri'] - system "MONGO_URL=\"#{uri}\" heroku mongo:pull" - else - abort "URI is missing :(" - end + abort "Please set MONGO_URL." unless ENV['MONGO_URL'] + system "heroku mongo:pull" end desc "mongo_push", "Pushes contents of your local MongoDB to remote MongoDB" def mongo_push - if uri = YAML.load_file('./config/mongo.yml')['development']['uri'] - system "MONGO_URL=\"#{uri}\" heroku mongo:push" - else - abort "URI is missing :(" - end + abort "Please set MONGO_URL." unless ENV['MONGO_URL'] + system "heroku mongo:push" end end end
Fix mongo_pull and mongo_push tasks to use MONGO_URL
diff --git a/overcommit.gemspec b/overcommit.gemspec index abc1234..def5678 100644 --- a/overcommit.gemspec +++ b/overcommit.gemspec @@ -29,5 +29,5 @@ s.add_dependency 'wopen3' s.add_development_dependency 'rspec', '2.14.1' - s.add_development_dependency 'image_optim', '0.10.2' + s.add_development_dependency 'image_optim', '0.11.1' end
Update image_optim dependency 0.10.2 -> 0.11.1 Changes can be seen at: https://github.com/toy/image_optim/compare/f1e50345206ffdd92bfeac901d43b0eff3a2f1ba...766405944890da22f3c4e7aa299e584cfcef66e0 Change-Id: I1f6ff0059f5f075791c4d9edfb0a338deb45bd4d Reviewed-on: http://gerrit.causes.com/35728 Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com> Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
diff --git a/ladle.gemspec b/ladle.gemspec index abc1234..def5678 100644 --- a/ladle.gemspec +++ b/ladle.gemspec @@ -7,7 +7,7 @@ Gem::Specification.new do |s| s.name = "ladle" s.version = Ladle::VERSION - s.platform = java ? Gem::Platform::JAVA : Gem::Platform::RUBY + s.platform = java ? 'java' : 'ruby' s.authors = ["Rhett Sutphin"] s.email = ["rhett@detailedbalance.net"] s.homepage = "http://github.com/rsutphin/ladle"
Fix gem packaging on JRuby.
diff --git a/cookie_requirement.gemspec b/cookie_requirement.gemspec index abc1234..def5678 100644 --- a/cookie_requirement.gemspec +++ b/cookie_requirement.gemspec @@ -6,7 +6,7 @@ s.platform = Gem::Platform::RUBY s.authors = [ 'Jonah Burke' ] s.email = [ 'jonah@jonahb.com' ] - s.homepage = '' + s.homepage = 'http://github.com/jonahb/cookie_requirement' s.summary = 'Ensure cookies are enabled in a Rails app.' s.description = s.summary
Add home page to gemspec
diff --git a/config/unicorn.rb b/config/unicorn.rb index abc1234..def5678 100644 --- a/config/unicorn.rb +++ b/config/unicorn.rb @@ -23,7 +23,8 @@ end if defined?(Resque) - Resque.redis = ENV['<REDIS_URI>'] + Resque.redis = ENV["REDISTOGO_URL"] if ENV["REDISTOGO_URL"] + Resque.redis ||= ENV["REDISCLOUD_URL"] if ENV["REDISCLOUD_URL"] Rails.logger.info('Connected to Redis') end
Set Resque.redis to correct ENV var
diff --git a/lib/pg_drive/uploader.rb b/lib/pg_drive/uploader.rb index abc1234..def5678 100644 --- a/lib/pg_drive/uploader.rb +++ b/lib/pg_drive/uploader.rb @@ -10,7 +10,7 @@ drive.authorization = credentials app_name = Rails.application.class.parent_name drive.insert_file( - Drive::File.new(title: "backup-#{app_name}-#{Time.now.to_i}"), + Drive::File.new(title: "backup-#{app_name}-#{Time.now.utc.iso8601}"), upload_source: gzip(content), content_type: GZIP_MIME_TYPE, options: { retries: RETRY_COUNT }
Change timestamp to be human readable
diff --git a/lib/presentator/slide.rb b/lib/presentator/slide.rb index abc1234..def5678 100644 --- a/lib/presentator/slide.rb +++ b/lib/presentator/slide.rb @@ -19,6 +19,8 @@ show_text element, offset: -index*2 end getch + clear + refresh end private
Refresh and clear, because we can!
diff --git a/lib/resourceful/maker.rb b/lib/resourceful/maker.rb index abc1234..def5678 100644 --- a/lib/resourceful/maker.rb +++ b/lib/resourceful/maker.rb @@ -27,6 +27,7 @@ def add_helpers helper_method(:object_path, :objects_path, :new_object_path, :edit_object_path, + :object_url, :objects_url, :new_object_url, :edit_object_url, :current_objects, :current_object, :current_model, :current_model_name, :namespaces, :instance_variable_name, :parents, :parent_model_names, :parent_objects, :save_succeeded?)
Make _url helpers accessible from views. git-svn-id: 30fef0787527f3d4b2d3639a5d6955e4dc84682e@112 c18eca5a-f828-0410-9317-b2e082e89db6
diff --git a/lib/tasks/searchbar.rake b/lib/tasks/searchbar.rake index abc1234..def5678 100644 --- a/lib/tasks/searchbar.rake +++ b/lib/tasks/searchbar.rake @@ -1,15 +1,23 @@ namespace :searchbar do desc 'Update educator student searchbar cached data' task update_for_all_educators: :environment do - Educator.all.each do |educator| + # This is a long-running task, and can take an hour or two to run slowly as an + # overnight task. + + # First, update this for all active educators. + puts 'Starting update for active educators...' + active_educators = Educator.active + active_educators.each do |educator| + puts " updating searchbar for educator.id: #{educator.id}..." EducatorSearchbar.update_student_searchbar_json!(educator) end - end + puts 'Done update.' - desc 'Update educator student searchbar data for those who have logged in' - task update_for_educators_who_log_in: :environment do - Educator.where("sign_in_count > ?", 0).each do |educator| - EducatorSearchbar.update_student_searchbar_json!(educator) - end + # Then prune any old records, for educators who are no longer active. + puts 'Pruning old records...' + records_to_prune = EducatorSearchbar.where.not(educator_id: active_educators.map(&:id)) + puts " found #{records_to_prune.size} records_to_prune, destroying them..." + records_to_prune.destroy! + puts 'Done prune.' end end
Searchbar: Update job to run based on active educators, not sign in
diff --git a/test/generators/transloadit/test_install_generator.rb b/test/generators/transloadit/test_install_generator.rb index abc1234..def5678 100644 --- a/test/generators/transloadit/test_install_generator.rb +++ b/test/generators/transloadit/test_install_generator.rb @@ -19,4 +19,8 @@ assert_file 'config/transloadit.yml' end + + test 'the namespace is transloadit:install' do + assert_equal 'transloadit:install', generator_class.namespace + end end
Test the generator is named correctly
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,8 +1,4 @@ Foosball::Application.routes.draw do - match '/' => redirect("http://protestsopa.org") - match '*players' => redirect("http://protestsopa.org") - match '*bagels' => redirect("http://protestsopa.org") - get 'players/all' => 'players#all' resources :bagels @@ -16,4 +12,4 @@ root :to => 'bagels#home' get 'sign_in' => 'sign_in#index' post 'sign_in' => 'sign_in#create' -end +end
Revert "Add sopa blackout redirection." This reverts commit 87cb8f556e4099533b61f194aa0edf74e4bb21bb.
diff --git a/config/initializers/ihat_supported_formats.rb b/config/initializers/ihat_supported_formats.rb index abc1234..def5678 100644 --- a/config/initializers/ihat_supported_formats.rb +++ b/config/initializers/ihat_supported_formats.rb @@ -7,7 +7,7 @@ is_json = %r{^application/json}.match(response.headers[:content_type]) if response && is_json Tahi::Application.config.ihat_supported_formats = - JSON.parse(response.body).dump + JSON.dump(JSON.parse(response.body)) else warn "Invalid JSON response from #{ENV['IHAT_URL']}" end
Call dump on JSON, since hash has no dump message :grimacing:
diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb index abc1234..def5678 100644 --- a/config/initializers/new_framework_defaults.rb +++ b/config/initializers/new_framework_defaults.rb @@ -18,7 +18,7 @@ Rails.application.config.active_record.belongs_to_required_by_default = true # Do not halt callback chains when a callback returns false. Previous versions had true. -ActiveSupport.halt_callback_chains_on_return_false = false +#ActiveSupport.halt_callback_chains_on_return_false = false # Configure SSL options to enable HSTS with subdomains. Previous versions had false. Rails.application.config.ssl_options = { hsts: { subdomains: true } }
Fix rails5.0 to rails5.2 behavior
diff --git a/test/generated_gio_test.rb b/test/generated_gio_test.rb index abc1234..def5678 100644 --- a/test/generated_gio_test.rb +++ b/test/generated_gio_test.rb @@ -7,10 +7,18 @@ GirFFI.setup :Gio end - should "create a GFile with #file_new_from_path" do - assert_nothing_raised { - Gio.file_new_for_path('/') - } + describe "#file_new_from_path, a method returning an interface," do + it "does not throw an error when generated" do + assert_nothing_raised { + Gio.file_new_for_path('/') + } + end + + it "returns an object of a more specific class" do + file = Gio.file_new_for_path('/') + refute_instance_of Gio::File, file + assert_includes file.class.ancestors, Gio::File + end end context "the FileInfo class" do
Make test for function returning GFile a bit more explicit.
diff --git a/puppet-lint-no_cron_resources-check.gemspec b/puppet-lint-no_cron_resources-check.gemspec index abc1234..def5678 100644 --- a/puppet-lint-no_cron_resources-check.gemspec +++ b/puppet-lint-no_cron_resources-check.gemspec @@ -22,7 +22,7 @@ spec.add_development_dependency 'rspec-its', '~> 1.0' spec.add_development_dependency 'rspec-collection_matchers', '~> 1.0' spec.add_development_dependency 'rubocop', '~> 0.75.0' - spec.add_development_dependency 'rake', '~> 11.2.0' + spec.add_development_dependency 'rake', '~> 13.0.0' spec.add_development_dependency 'rspec-json_expectations', '~> 2.2' spec.add_development_dependency 'simplecov', '~> 0.17.1' end
Update rake requirement from ~> 11.2.0 to ~> 13.0.0 Updates the requirements on [rake](https://github.com/ruby/rake) to permit the latest version. - [Release notes](https://github.com/ruby/rake/releases) - [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc) - [Commits](https://github.com/ruby/rake/compare/v11.2.0...v13.0.0) Signed-off-by: dependabot-preview[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@dependabot.com>
diff --git a/parser.gemspec b/parser.gemspec index abc1234..def5678 100644 --- a/parser.gemspec +++ b/parser.gemspec @@ -25,7 +25,9 @@ spec.add_development_dependency 'bundler', '~> 1.3' spec.add_development_dependency 'rake', '~> 0.9' spec.add_development_dependency 'racc' + spec.add_development_dependency 'minitest', '~> 4.7.0' spec.add_development_dependency 'simplecov', '~> 0.7' spec.add_development_dependency 'coveralls' + spec.add_development_dependency 'json_pure' # for coveralls on 1.9.2 end
Add json_pure for coveralls on 1.9.2.
diff --git a/config/initializers/i18n.rb b/config/initializers/i18n.rb index abc1234..def5678 100644 --- a/config/initializers/i18n.rb +++ b/config/initializers/i18n.rb @@ -0,0 +1,31 @@+# config/initializers/i18n.rb +# https://github.com/svenfuchs/i18n/issues/123 + +module I18n + module Backend + module Pluralization + # Overriding the pluralization method so if the proper plural form is missing we will try + # to fallback to the default gettext plural form (which is the `germanic` one). + def pluralize(locale, entry, count) + return entry unless entry.is_a?(Hash) && count + + pluralizer = pluralizer(locale) + if pluralizer.respond_to?(:call) + return entry[:zero] if count == 0 && entry.key?(:zero) + + plural_key = pluralizer.call(count) + return entry[plural_key] if entry.key?(plural_key) + + # fallback to the default gettext plural forms if real entry is missing (for example :few) + default_gettext_key = count == 1 ? :one : :other + return entry[default_gettext_key] if entry.key?(default_gettext_key) + + # If nothing is found throw the classic exception + raise InvalidPluralizationData.new(entry, count) + else + super + end + end + end + end +end
Fix translation bug in Czech When the :few key is missing fallback to :other key if present
diff --git a/spec/entities/resource_group_spec.rb b/spec/entities/resource_group_spec.rb index abc1234..def5678 100644 --- a/spec/entities/resource_group_spec.rb +++ b/spec/entities/resource_group_spec.rb @@ -0,0 +1,24 @@+describe Dox::Entities::ResourceGroup do + subject { described_class } + + let(:resource_group_name) { 'Pokemons' } + let(:details) do + { + resource_group_desc: 'Pokemons' + } + end + + let(:resource_group) { subject.new(resource_group_name, details) } + + describe '#name' do + it { expect(resource_group.name).to eq(resource_group_name) } + end + + describe '#desc' do + it { expect(resource_group.desc).to eq(details[:resource_group_desc]) } + end + + describe '#resources' do + it { expect(resource_group.resources).to eq({}) } + end +end
Add entities specs for resource group
diff --git a/spec/integration/mutant/null_spec.rb b/spec/integration/mutant/null_spec.rb index abc1234..def5678 100644 --- a/spec/integration/mutant/null_spec.rb +++ b/spec/integration/mutant/null_spec.rb @@ -0,0 +1,18 @@+# encoding: utf-8 + +require 'spec_helper' + +describe 'null integration' do + + let(:base_cmd) { 'bundle exec mutant -I lib --require test_app "::TestApp*"' } + + around do |example| + Dir.chdir(TestApp.root) do + example.run + end + end + + specify 'it allows to kill mutations' do + expect(Kernel.system(base_cmd)).to be(true) + end +end
Add integration spec for 'null' strategy
diff --git a/spec/models/duckrails/header_spec.rb b/spec/models/duckrails/header_spec.rb index abc1234..def5678 100644 --- a/spec/models/duckrails/header_spec.rb +++ b/spec/models/duckrails/header_spec.rb @@ -1,5 +1,46 @@ require 'rails_helper' -RSpec.describe Duckrails::Header, type: :model do - pending "add some examples to (or delete) #{__FILE__}" +module Duckrails + RSpec.describe Header, type: :model do + context 'attributes' do + it { should respond_to :name, :name= } + it { should respond_to :value, :value= } + end + + context 'relations' do + it { should belong_to :mock } + end + + context 'validations' do + it { should validate_presence_of :name } + it { should validate_presence_of :value } + it { should validate_presence_of :mock } + end + + context 'CRUD' do + let(:mock) { FactoryGirl.create :mock } + + it 'should save headers' do + header = FactoryGirl.build :header, mock: mock + + expect{ header.save }.to change(Header, :count).from(0).to(1) + end + + it 'should update headers' do + header = FactoryGirl.create :header, mock: mock + + header.name = 'New Header Name' + expect(header.save).to be true + + header.reload + expect(header.name).to eq 'New Header Name' + end + + it 'should destroy headers' do + header = FactoryGirl.create :header, mock: mock + + expect{ header.destroy }.to change(Header, :count).from(1).to(0) + end + end + end end
Add specs for Header model.
diff --git a/config/initializers/fog.rb b/config/initializers/fog.rb index abc1234..def5678 100644 --- a/config/initializers/fog.rb +++ b/config/initializers/fog.rb @@ -2,26 +2,29 @@ CarrierWave.configure do |config| if Rails.env.development? || Rails.env.test? - # config.fog_directory = 'policeboard-staging' - config.storage = :file + CarrierWave.configure do |config| + config.storage = :file + end end + config.fog_provider = 'fog/aws' + + config.fog_credentials = { + provider: 'AWS', + region: ENV["AWS_REGION"], # optional, defaults to 'us-east-1' + aws_access_key_id: ENV["AWS_ACCESS_KEY_ID"] || 'awskey', + aws_secret_access_key: ENV["AWS_SECRET_KEY"] || 'awssecret' + } + + config.fog_directory = 'policeboard-production' + + config.fog_public = true # optional, defaults to true + config.fog_attributes = { 'Cache-Control' => "max-age=#{365.day.to_i}" } # optional, defaults to {} + if Rails.env.production? - config.storage = :fog - - config.fog_provider = 'fog/aws' - - config.fog_credentials = { - provider: 'AWS', - region: ENV["AWS_REGION"], # optional, defaults to 'us-east-1' - aws_access_key_id: ENV["AWS_ACCESS_KEY_ID"], - aws_secret_access_key: ENV["AWS_SECRET_KEY"] - } - - config.fog_directory = 'policeboard-production' - - config.fog_public = true # optional, defaults to true - config.fog_attributes = { 'Cache-Control' => "max-age=#{365.day.to_i}" } # optional, defaults to {} + CarrierWave.configure do |config| + config.storage = :fog + end end end
Update CarrierWave config for prod
diff --git a/tumblfetch.gemspec b/tumblfetch.gemspec index abc1234..def5678 100644 --- a/tumblfetch.gemspec +++ b/tumblfetch.gemspec @@ -20,6 +20,7 @@ spec.add_runtime_dependency 'tumblr_client', '~> 0.8' spec.add_runtime_dependency 'faraday', '= 0.8.9' + spec.add_runtime_dependency 'thor' spec.add_development_dependency "bundler", "~> 1.5" spec.add_development_dependency "rake"
Use thor for command-line interfaces
diff --git a/mogenerator.rb b/mogenerator.rb index abc1234..def5678 100644 --- a/mogenerator.rb +++ b/mogenerator.rb @@ -0,0 +1,14 @@+require "formula" + +class Mogenerator < Formula + homepage "https://github.com/rentzsch/mogenerator" + + head "https://github.com/rentzsch/mogenerator.git", :revision => "258832" + + depends_on :xcode => :build + + def install + xcodebuild "-target", "mogenerator", "-configuration", "Release","SYMROOT=symroot", "OBJROOT=objroot" + bin.install "symroot/Release/mogenerator" + end +end
Add formula for Homebrew for iOS development
diff --git a/core/enumerator/new_spec.rb b/core/enumerator/new_spec.rb index abc1234..def5678 100644 --- a/core/enumerator/new_spec.rb +++ b/core/enumerator/new_spec.rb @@ -6,15 +6,17 @@ describe "Enumerator.new" do it_behaves_like(:enum_new, :new) - ruby_version_is "1.8.8" do + ruby_version_is "1.9.1" do + # Maybe spec should be broken up? it "accepts a block" do enum = enumerator_class.new do |yielder| - yielder.yield 3 - yielder.yield 2 - yielder.yield 1 + r = yielder.yield 3 + yielder << r << 2 << 1 end enum.should be_an_instance_of(enumerator_class) - enum.to_a.should == [3,2,1] + r = [] + enum.each{|x| r << x; x * 2} + r.should == [3, 6, 2, 1] end it "ignores block if arg given" do
Expand spec for Enumerator.new with block
diff --git a/spec/lib/cli_spec.rb b/spec/lib/cli_spec.rb index abc1234..def5678 100644 --- a/spec/lib/cli_spec.rb +++ b/spec/lib/cli_spec.rb @@ -0,0 +1,19 @@+require 'spec_helper' +require 'stringio' +require 'markdo/cli' + +module Markdo + describe CLI do + describe 'given "version"' do + it 'prints the version' do + out = StringIO.new + err = StringIO.new + env = {} + + CLI.new(out, err, env).run('version') + + expect(out.string).to match(/v[0-9.]+[a-z0-9]+\n/) + end + end + end +end
Add spec for `markdo version`
diff --git a/redis.gemspec b/redis.gemspec index abc1234..def5678 100644 --- a/redis.gemspec +++ b/redis.gemspec @@ -33,7 +33,7 @@ s.files = Dir["CHANGELOG.md", "LICENSE", "README.md", "lib/**/*"] s.executables = `git ls-files -- exe/*`.split("\n").map{ |f| File.basename(f) } - s.required_ruby_version = '>= 2.2.2' + s.required_ruby_version = '>= 2.3.0' s.add_development_dependency("mocha") s.add_development_dependency("hiredis")
Mark gems as requiring Ruby 2.3
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index abc1234..def5678 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -23,6 +23,7 @@ def handle_login_failure(auth_hash) Rails.logger.warn "OAuth login failed with jwt_data: #{auth_hash[:extra][:raw_info][:jwt_data]}" Raven.capture_message 'OAuth login failed', + level: 'warning', extra: auth_hash[:extra][:raw_info] return redirect_to errors_login_error_path end
Change error level to 'warning' for login failure This is pretty well-understood; it's always "mwoauthdatastore-access-token-not-found", likely because of the same token being sent twice or somesuch. We handle it well-ish on our end now.
diff --git a/app/controllers/projects/artifacts_controller.rb b/app/controllers/projects/artifacts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/projects/artifacts_controller.rb +++ b/app/controllers/projects/artifacts_controller.rb @@ -8,7 +8,7 @@ end unless artifacts_file.exists? - return not_found! + return render_404 end send_file artifacts_file.path, disposition: 'attachment'
Fix nonexistent method in artifacts controller
diff --git a/app/models/concerns/gobierto_common/sluggable.rb b/app/models/concerns/gobierto_common/sluggable.rb index abc1234..def5678 100644 --- a/app/models/concerns/gobierto_common/sluggable.rb +++ b/app/models/concerns/gobierto_common/sluggable.rb @@ -21,11 +21,12 @@ new_slug = base_slug if uniqueness_validators.present? - count = 2 uniqueness_validators.each do |validator| - while self.class.exists?(scope_attributes(validator.options[:scope]).merge(slug: new_slug)) - new_slug = "#{ base_slug }-#{ count }" - count += 1 + if (related_slugs = self.class.where("slug ~* ?", "#{ new_slug }-\\d+$").where(scope_attributes(validator.options[:scope]))).exists? + max_count = related_slugs.pluck(:slug).map { |slug| slug.scan(/\d+$/).first.to_i }.max + new_slug = "#{ base_slug }-#{ max_count + 1 }" + elsif self.class.exists?(scope_attributes(validator.options[:scope]).merge(slug: new_slug)) + new_slug = "#{ base_slug }-2" end end end
Refactor slug counter calculation to avoid increasing queries
diff --git a/phare.gemspec b/phare.gemspec index abc1234..def5678 100644 --- a/phare.gemspec +++ b/phare.gemspec @@ -8,8 +8,8 @@ spec.version = Phare::VERSION spec.authors = ['Rémi Prévost'] spec.email = ['remi@exomel.com'] - spec.description = '' - spec.summary = '' + spec.description = 'Phare looks into your files and check for (Ruby, JavaScript and SCSS) coding style errors.' + spec.summary = spec.description spec.homepage = 'https://github.com/mirego/phare' spec.license = 'BSD 3-Clause'
Update gem description and summary
diff --git a/spec/features/submission_print_rate_spec.rb b/spec/features/submission_print_rate_spec.rb index abc1234..def5678 100644 --- a/spec/features/submission_print_rate_spec.rb +++ b/spec/features/submission_print_rate_spec.rb @@ -4,13 +4,10 @@ let!(:user) { FactoryGirl.create(:user) } context "when the submission has required number of rates" do + before { submission.rates << FactoryGirl.build_list(:rate, SubmissionRepository::REQUIRED_RATES_NUM) } + it "shows ratings in submission view" do - SubmissionRepository::REQUIRED_RATES_NUM.times do - rate = FactoryGirl.create(:rate) - submission.rates << rate - end sample_rate = submission.rates.sample - login_as(user, scope: :user) visit submission_path(submission.id) expect(page).to have_text("#{sample_rate.user.nickname} #{sample_rate.value}") @@ -19,13 +16,10 @@ context "when the submission does not have required number of rates" do + before { submission.rates << FactoryGirl.build_list(:rate, SubmissionRepository::REQUIRED_RATES_NUM-1) } + it "does not show rates in submission view" do - (SubmissionRepository::REQUIRED_RATES_NUM - 1).times do - rate = FactoryGirl.create(:rate) - submission.rates << rate - end sample_rate = submission.rates.sample - login_as(user, scope: :user) visit submission_path(submission.id) expect(page).not_to have_text("#{sample_rate.user.nickname} #{sample_rate.value}")
Refactor submission pront rate spec
diff --git a/spec/services/itsi_authoring/editor_spec.rb b/spec/services/itsi_authoring/editor_spec.rb index abc1234..def5678 100644 --- a/spec/services/itsi_authoring/editor_spec.rb +++ b/spec/services/itsi_authoring/editor_spec.rb @@ -10,17 +10,40 @@ activity } - let(:page) { FactoryGirl.create(:interactive_page, name: "page 1", position: 0) } - let(:interactive) { FactoryGirl.create(:managed_interactive) } + let(:page) { FactoryGirl.create(:interactive_page, + name: "page 1", + position: 0 + )} + let(:library_interactive) { FactoryGirl.create(:library_interactive, + name: 'Test Library Interactive', + base_url: 'https://concord.org/' + )} + let(:managed_interactive) { FactoryGirl.create(:managed_interactive, + library_interactive: library_interactive, + url_fragment: "test" + )} before(:each) do - page.add_interactive interactive + page.add_interactive(managed_interactive) page.reload + activity.pages << page end it "generates JSON for ITSI authoring" do editor = ITSIAuthoring::Editor.new(activity) itsi_content = editor.to_json expect(itsi_content).to have_key(:sections) + expect(itsi_content[:sections].length).to eq(1) + expect(itsi_content[:sections].first).to match( + hash_including( + interactives: include( + hash_including( + type: "managed_interactive", + name: "Test Library Interactive", + url: "https://concord.org/test" + ) + ) + ) + ) end end
Improve ITSI authoring editor spec test.
diff --git a/.github/REPRODUCTION_SCRIPT.rb b/.github/REPRODUCTION_SCRIPT.rb index abc1234..def5678 100644 --- a/.github/REPRODUCTION_SCRIPT.rb +++ b/.github/REPRODUCTION_SCRIPT.rb @@ -4,13 +4,25 @@ source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } gem "factory_bot", "~> 5.0" + gem "activerecord" + gem "sqlite3" end +require "active_record" require "factory_bot" require "minitest/autorun" +require "logger" -class Post - attr_accessor :body +ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:") +ActiveRecord::Base.logger = Logger.new(STDOUT) + +ActiveRecord::Schema.define do + create_table :posts, force: true do |t| + t.string :body + end +end + +class Post < ActiveRecord::Base end FactoryBot.define do
Add basic AR setup to reproduction script Many of our bug reports involve interactions between factory_bot and active_record. This will make it easier for people to submit reproduction scripts for those cases.
diff --git a/api/spec/support/controller_hacks.rb b/api/spec/support/controller_hacks.rb index abc1234..def5678 100644 --- a/api/spec/support/controller_hacks.rb +++ b/api/spec/support/controller_hacks.rb @@ -17,7 +17,8 @@ end def api_process(action, params={}, session=nil, flash=nil, method="get") - process(action, params.reverse_merge!(:use_route => :spree, :format => :json), session, { :foo => "bar" }, method) + scoping = respond_to?(:resource_scoping) ? resource_scoping : {} + process(action, params.merge(scoping).reverse_merge!(:use_route => :spree, :format => :json), session, { :foo => "bar" }, method) end end
Allow scoping of requests in tests by definition of a resource_scoping method (i.e. a let) in the API tests
diff --git a/app/controllers/jmd/participants_controller.rb b/app/controllers/jmd/participants_controller.rb index abc1234..def5678 100644 --- a/app/controllers/jmd/participants_controller.rb +++ b/app/controllers/jmd/participants_controller.rb @@ -6,6 +6,7 @@ def index # @competition and @participants are fetched by CanCan + # TODO: Why doesn't authorization work although competition can be accessed by user? @participants = @participants.includes(:country).order(:last_name) end
Add TODO to solve participant authorization
diff --git a/pugbot.gemspec b/pugbot.gemspec index abc1234..def5678 100644 --- a/pugbot.gemspec +++ b/pugbot.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |gem| gem.name = "pugbot" - gem.version = "0.1.0" + gem.version = "0.1.1" gem.authors = ["Xzanth"] gem.description = "Pug bot as cinch plugin" gem.summary = "Cinch plugin for organising pick up games, designed"\
Upgrade version number to 0.1.1
diff --git a/spec/controllers/api/v1/games_controller_spec.rb b/spec/controllers/api/v1/games_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/api/v1/games_controller_spec.rb +++ b/spec/controllers/api/v1/games_controller_spec.rb @@ -19,12 +19,13 @@ expect(response).to have_http_status(:ok) end - it "assigns all games" do - FactoryGirl.create_list(:game, 2) + it "assigns the machine's games" do + all = FactoryGirl.create_list(:game, 3) + all.last(2).each { |g| Installation.create! game: g, arcade_machine: winnitron } request.headers["Authorization"] = "Token #{token}" get :index, { format: "json" } - expect(assigns(:games)).to eq Game.all + expect(assigns(:games)).to eq all.last(2) end end
Return only the machine's games in the API.
diff --git a/spec/controllers/opportunity_controlller_spec.rb b/spec/controllers/opportunity_controlller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/opportunity_controlller_spec.rb +++ b/spec/controllers/opportunity_controlller_spec.rb @@ -2,10 +2,15 @@ RSpec.describe OpportunitiesController, type: :controller do - it 'render #index' do - get :index - expect(response.status).to eq(200) - expect(response).to render_template(['opportunities/index', 'layouts/jobs']) + describe "GET index" do + it "should respond with 200" do + get :index + expect(response.status).to eq(200) + end + + it "should render the opportunities index template with jobs layout" do + get :index + expect(response).to render_template(['opportunities/index', 'layouts/jobs']) + end end - end
Refactor opportunities controller tests to separate one assert per test
diff --git a/ruby/puppy.rb b/ruby/puppy.rb index abc1234..def5678 100644 --- a/ruby/puppy.rb +++ b/ruby/puppy.rb @@ -0,0 +1,13 @@+# SPECIES ------------------------ +# puppy + +# CHARACTERISTICS ---------------- +# color: varies +# species: varies +# name: varies + +# BEHAVIOR ----------------------- +# bark +# wag tail +# fetch +
Add class design to code
diff --git a/spec/microphite_spec.rb b/spec/microphite_spec.rb index abc1234..def5678 100644 --- a/spec/microphite_spec.rb +++ b/spec/microphite_spec.rb @@ -1,14 +1,14 @@ # Sanity tests for the convenience factories module Microphite describe :client do - before_block = Proc.new { @client = Microphite::Client::Socket.new(host: 'localhost') } + before_block = Proc.new { @client = Microphite.client(host: 'localhost') } after_block = Proc.new {} it_should_behave_like 'a microphite client', before_block, after_block end describe :noop do - before_block = Proc.new { @client = Microphite::Client::Noop.new(host: 'localhost') } + before_block = Proc.new { @client = Microphite.noop(host: 'localhost') } after_block = Proc.new {} it_should_behave_like 'a microphite client', before_block, after_block
Fix module convenience method coverage
diff --git a/spec/middleware_spec.rb b/spec/middleware_spec.rb index abc1234..def5678 100644 --- a/spec/middleware_spec.rb +++ b/spec/middleware_spec.rb @@ -4,10 +4,10 @@ describe 'UTF8Cleaner::Middleware' do let :env do { - 'PATH_INFO' => 'foo/bar%2e%2fbaz', + 'PATH_INFO' => 'foo/%FFbar%2e%2fbaz%26%3B', 'QUERY_STRING' => 'foo=bar%FF', 'HTTP_REFERER' => 'http://example.com/blog+Result:+%ED%E5+%ED%E0%F8%EB%EE%F1%FC+%F4%EE%F0%EC%FB+%E4%EB%FF+%EE%F2%EF%F0%E0%E2%EA%E8', - 'REQUEST_URI' => '%C3%89' + 'REQUEST_URI' => '%C3%89%E2%9C%93' } end @@ -15,24 +15,13 @@ UTF8Cleaner::Middleware.new(nil).send(:sanitize_env, env) end - it "removes invalid UTF-8 sequences" do - new_env['QUERY_STRING'].should == 'foo=bar' + describe "removes invalid UTF-8 sequences" do + it { new_env['QUERY_STRING'].should == 'foo=bar' } + it { new_env['HTTP_REFERER'].should == 'http://example.com/blog+Result:+++++' } end - it "turns valid %-escaped ASCII chars into their ASCII equivalents" do - new_env['PATH_INFO'].should == 'foo/bar./baz' - end - - it "leaves valid %-escaped UTF-8 chars alone" do - new_env['REQUEST_URI'].should == '%C3%89' - end - - it "handles an awful URL" do - new_env['HTTP_REFERER'].should == 'http://example.com/blog+Result:+++++' - end - - it "reencodes ampersands and semicolons" do - result = UTF8Cleaner::Middleware.new(nil).send(:sanitize_env, env.merge('QUERY_STRING' => 'foo%26bar%3Bbaz')) - result['QUERY_STRING'].should == 'foo%26bar%3Bbaz' + describe "leaves all valid characters untouched" do + it { new_env['PATH_INFO'].should == 'foo/bar%2e%2fbaz%26%3B' } + it { new_env['REQUEST_URI'].should == '%C3%89%E2%9C%93' } end end
Revise specs to provide guidelines for conservative behavior
diff --git a/BHCDatabase/test/test_helper.rb b/BHCDatabase/test/test_helper.rb index abc1234..def5678 100644 --- a/BHCDatabase/test/test_helper.rb +++ b/BHCDatabase/test/test_helper.rb @@ -3,6 +3,7 @@ require 'rails/test_help' require "minitest/reporters" Minitest::Reporters.use! +ActiveRecord::Migration.maintain_test_schema! if defined?(ActiveRecord::Migration) class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
Fix to avoid calling db:test:prepare
diff --git a/lib/chef/resource/aws_sqs_queue.rb b/lib/chef/resource/aws_sqs_queue.rb index abc1234..def5678 100644 --- a/lib/chef/resource/aws_sqs_queue.rb +++ b/lib/chef/resource/aws_sqs_queue.rb @@ -7,9 +7,9 @@ actions :create, :delete, :nothing default_action :create - attribute :name, String, :name_attribute => true - attribute :queue_name, String - stored_attribute :created_at, DateTime + attribute :name, :kind_of => String, :name_attribute => true + attribute :queue_name, :kind_of => String + stored_attribute :created_at, :kind_of => DateTime attribute :name, :kind_of => String, :name_attribute => true attribute :queue_name, :kind_of => String stored_attribute :created_at
Fix attribute to work with LWRP syntax
diff --git a/app/controllers/email_confirmation_controller.rb b/app/controllers/email_confirmation_controller.rb index abc1234..def5678 100644 --- a/app/controllers/email_confirmation_controller.rb +++ b/app/controllers/email_confirmation_controller.rb @@ -1,11 +1,20 @@ # frozen_string_literal: true class EmailConfirmationController < ApplicationController + include AuthToken + def verify - @errors = AuthTokenVerifier.verify(params) + verifier = AuthTokenVerifier.new(params[:token]).verify + + ## FIXME seed and fetch from DB + # view = File.read("#{Rails.root}/app/liquid/views/layouts/email-confirmation-follow-up.liquid") template = Liquid::Template.parse(view) - @rendered = template.render('errors' => @errors, 'success' => @errors.blank?).html_safe + if verifier.success? + cookies.signed['authentication_id'] = encode_jwt(verifier.authentication.member.token_payload) + end + + @rendered = template.render('errors' => verifier.errors).html_safe render 'email_confirmation/follow_up', layout: 'generic' end end
Create a session cookie when member confirms registration
diff --git a/lib/apiarist/resource_controller/responder.rb b/lib/apiarist/resource_controller/responder.rb index abc1234..def5678 100644 --- a/lib/apiarist/resource_controller/responder.rb +++ b/lib/apiarist/resource_controller/responder.rb @@ -7,13 +7,15 @@ delegate :serialize, :_serialization_scope, to: :controller def display(resource, options = {}) + super({root => serialize(resource, scope: _serialization_scope)}, options) + end + + def root if resource.respond_to?(:each) - root = controller.send(:resource_class).name.underscore.pluralize + controller.send(:resource_collection_name) else - root = controller.send(:resource_class).name.underscore + controller.send(:resource_instance_name) end - - super({root => serialize(resource, scope: _serialization_scope)}, options) end end end
FIX: Use resource_instance_name and resource_collection_name rather than mangling with resource class name
diff --git a/lib/cyoi/providers/constants/aws_constants.rb b/lib/cyoi/providers/constants/aws_constants.rb index abc1234..def5678 100644 --- a/lib/cyoi/providers/constants/aws_constants.rb +++ b/lib/cyoi/providers/constants/aws_constants.rb @@ -16,6 +16,7 @@ { label: "Asia Pacific (Singapore) Region", code: "ap-southeast-1" }, { label: "Asia Pacific (Sydney) Region", code: "ap-southeast-2" }, { label: "Asia Pacific (Tokyo) Region", code: "ap-northeast-1" }, + { label: "Asia Pacific (Seoul) Region", code: "ap-northeast-2" }, { label: "South America (Sao Paulo) Region", code: "sa-east-1" }, { label: "China (Beijing) Region", code: "cn-north-1" }, ]
Add AWS Asia Pacific (Seoul) Region
diff --git a/lib/facebooker/rails/extensions/rack_setup.rb b/lib/facebooker/rails/extensions/rack_setup.rb index abc1234..def5678 100644 --- a/lib/facebooker/rails/extensions/rack_setup.rb +++ b/lib/facebooker/rails/extensions/rack_setup.rb @@ -1,2 +1,8 @@+# Somewhere in 2.3 RewindableInput was removed- rack supports it natively require 'rack/facebook' -ActionController::Dispatcher.middleware.insert_after 'ActionController::RewindableInput',Rack::Facebook, Facebooker.secret_key+ActionController::Dispatcher.middleware.insert_after( + (Object.const_get('ActionController::RewindableInput') rescue false) ? + 'ActionController::RewindableInput' : + 'ActionController::Session::CookieStore', + Rack::Facebook, + Facebooker.secret_key )
Allow the rack middle_ware to fall back from after RewindableInput to after Session::CookieStore if RewindableInput is not available. It was removed somewhere in Rails 2.3
diff --git a/lib/j-cap-recipes/tasks/handy.rake b/lib/j-cap-recipes/tasks/handy.rake index abc1234..def5678 100644 --- a/lib/j-cap-recipes/tasks/handy.rake +++ b/lib/j-cap-recipes/tasks/handy.rake @@ -4,7 +4,7 @@ namespace :settings do desc 'Update the remote config/settings/<stage>.yml file with local' - task :upload do + task upload: :delete do invoke "config/settings/#{fetch(:stage)}.yml" end
:panda_face: Remove the old settings before upload a new one.
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 @@ -12,6 +12,7 @@ :memory_limit => 4096 }, :passenger => { + :version => 4, :max_pool_size => 12 } )
Revert to passenger 4 on backend servers
diff --git a/lib/neighborly/balanced/bankaccount/engine.rb b/lib/neighborly/balanced/bankaccount/engine.rb index abc1234..def5678 100644 --- a/lib/neighborly/balanced/bankaccount/engine.rb +++ b/lib/neighborly/balanced/bankaccount/engine.rb @@ -3,6 +3,11 @@ module Bankaccount class Engine < ::Rails::Engine isolate_namespace Neighborly::Balanced::Bankaccount + initializer 'action_controller' do |app| + ActiveSupport.on_load :action_controller do + helper Rails.application.helpers + end + end end end end
Load helpers from main application With this we are able to use helpers that is on the main application. It also allow us to render the application layout here in the engine.
diff --git a/rake/common.rb b/rake/common.rb index abc1234..def5678 100644 --- a/rake/common.rb +++ b/rake/common.rb @@ -3,7 +3,7 @@ PUPPET_BINARY = File.join(BASEDIR, 'bin', 'puppet').freeze TEST_COMMAND = begin if ENV['TRAVIS'] - "rspec --suffix '_spec.rb$'" + "rspec --pattern '*_spec.rb'" else "parallel_rspec --suffix '_spec.rb$'" end
Correct pattern arg for rspec
diff --git a/stackdriver/ruby_debugger.rb b/stackdriver/ruby_debugger.rb index abc1234..def5678 100644 --- a/stackdriver/ruby_debugger.rb +++ b/stackdriver/ruby_debugger.rb @@ -15,8 +15,8 @@ # [START explicit_debugger_ruby] require "google/cloud/debugger" -Google::Cloud::Debugger.new(project_id: "YOUR-PROJECT-ID", - keyfile: "/path/to/service-account.json").start +Google::Cloud::Debugger.new(project: "YOUR-PROJECT-ID", + keyfile: "/path/to/service-account.json").start # [END explicit_debugger_ruby] # [START implicit_debugger_ruby]
Update project_id to project for standalone ruby sample
diff --git a/spec/views/ideas/new.html.erb_spec.rb b/spec/views/ideas/new.html.erb_spec.rb index abc1234..def5678 100644 --- a/spec/views/ideas/new.html.erb_spec.rb +++ b/spec/views/ideas/new.html.erb_spec.rb @@ -14,5 +14,15 @@ expect(rendered).to have_selector('div.form-group', :count => 3) expect(rendered).to have_selector('div.references', :count => 0) end + + it "for user without an email should prompt them to add one" do + user = create(:no_email_user) + allow(view).to receive(:current_user).and_return(user) + idea = Idea.new + assign(:idea, idea) + + render :template => "ideas/new.html.erb" + expect(rendered).to match /Please add an email address to your account before continuing/ + end end end
Test for email form presence
diff --git a/test/spec/Sandbox/Application_filtration_spec.rb b/test/spec/Sandbox/Application_filtration_spec.rb index abc1234..def5678 100644 --- a/test/spec/Sandbox/Application_filtration_spec.rb +++ b/test/spec/Sandbox/Application_filtration_spec.rb @@ -0,0 +1,58 @@+require 'minitest/autorun' +require_relative '../../../lib/Sandbox/Application' + +describe Sandbox::Application do + + before do + @application = Sandbox::Application.new({ + # Do not require any resources outside this spec + autorequire: { + directories: [] + }, + + # Only delegate get and post requests to Resources + resource_methods: [:get, :post] + }) + end + + # A resource skeleton that we can modify per test + class ChainFilterResource + extend Sandbox::Resource + extend Sandbox::Resource::BeforeChain + + @@handler = self.new + + attr_accessor :before_chain + attr_accessor :doget + + def self.getHandler ; @@handler ; end + def get(request) ; @doget.call(request) ; end + end + + # A filter defined by a lambda + class LamdaChainFilter + def initialize(filter) + @filter = filter + end + + def filter(request = {}) + @filter.call(request) + end + end + + class FilterException < StandardError ; end + + it 'Invokes the Resource before-chain prior to request methods' do + + get_called = false + handler = ChainFilterResource.getHandler + handler.before_chain = [ LamdaChainFilter.new(lambda { fail }) ] + handler.doget = lambda { |request| get_called = true } + + assert_raises(FilterException) do + @application.handle_request(:ChainFilterResource, :get) + end + assert_equal false, get_called + end + +end
Move filtration spec into own test script
diff --git a/test/integration/default/serverspec/cookbook/default_spec.rb b/test/integration/default/serverspec/cookbook/default_spec.rb index abc1234..def5678 100644 --- a/test/integration/default/serverspec/cookbook/default_spec.rb +++ b/test/integration/default/serverspec/cookbook/default_spec.rb @@ -15,6 +15,9 @@ require 'spec_helper' +# FIXME: ServerSpec fails when "Installing Busser plugins: busser-serverspec" +# because Test-kitchen assumes chef-client is installed instead of ChefDK +# and expects ruby.exe to be in the location where chef-client installs it. describe command('vagrant -v') do its(:exit_status) { should eq(0) } end
Add comment to failing ServerSpec test
diff --git a/wp_roster.gemspec b/wp_roster.gemspec index abc1234..def5678 100644 --- a/wp_roster.gemspec +++ b/wp_roster.gemspec @@ -9,6 +9,7 @@ s.authors = ["Deans Charbal"] s.summary = %q{A gem for accessing current MLB rosters using Wikipedia template pages.} s.description = s.summary + s.homepage = "https://github.com/deansc/wp_roster" s.license = "MIT" s.files = `git ls-files -z`.split("\x0")
Add homepage in gemspec file.
diff --git a/simple_oauth.gemspec b/simple_oauth.gemspec index abc1234..def5678 100644 --- a/simple_oauth.gemspec +++ b/simple_oauth.gemspec @@ -6,7 +6,7 @@ gem.add_development_dependency 'rake', '~> 0.8' gem.add_development_dependency 'simplecov', '~> 0.4' gem.add_development_dependency 'turn', '~> 0.8' - gem.add_development_dependency 'yard', '~> 0.6' + gem.add_development_dependency 'yard', '~> 0.7' gem.authors = ["Steve Richert", "Erik Michaels-Ober"] gem.description = 'Simply builds and verifies OAuth headers' gem.email = ['steve.richert@gmail.com', 'sferik@gmail.com']
Update yard dependency to version 0.7
diff --git a/.chef/knife-dev.rb b/.chef/knife-dev.rb index abc1234..def5678 100644 --- a/.chef/knife-dev.rb +++ b/.chef/knife-dev.rb @@ -5,7 +5,7 @@ client_key "#{current_dir}/admin-dev.pem" validation_client_name 'chef-validator' validation_key "#{current_dir}/chef-validator-dev.pem" -chef_server_url 'https://192.168.250.10/' +chef_server_url 'https://192.168.250.2/' syntax_check_cache_path "#{current_dir}/syntax_check_cache" cookbook_path [ "#{current_dir}/../cookbooks", "#{current_dir}/../site-cookbooks" ] knife[:editor] = '/usr/bin/vim'
Fix bug chef serveur dev.
diff --git a/SPTDataLoader.podspec b/SPTDataLoader.podspec index abc1234..def5678 100644 --- a/SPTDataLoader.podspec +++ b/SPTDataLoader.podspec @@ -15,7 +15,7 @@ s.license = "Apache 2.0" s.author = { "Will Sackfield" => "sackfield@spotify.com" } s.platform = :ios, "7.0" - s.source = { :git => "https://github.com/spotify/SPTDataLoader.git", :tag => "1.0.1" } + s.source = { :git => "https://github.com/spotify/SPTDataLoader.git", :tag => "#{s.version}" } s.source_files = "include/SPTDataLoader/*.h", "SPTDataLoader/*.{h,m}" s.public_header_files = "include/SPTDataLoader/*.h" s.xcconfig = { 'OTHER_LDFLAGS' => '-lObjC' }
Make the tag the version * It will never be anything else
diff --git a/core/app/interactors/interactors/channels/add_fact.rb b/core/app/interactors/interactors/channels/add_fact.rb index abc1234..def5678 100644 --- a/core/app/interactors/interactors/channels/add_fact.rb +++ b/core/app/interactors/interactors/channels/add_fact.rb @@ -9,7 +9,7 @@ command :"channels/add_fact", @fact, @channel if @fact.site - command :'site/add_top_topic', @fact.site.id.to_i, @channel.topic.id.to_s + command :'site/add_top_topic', @fact.site.id.to_i, @channel.topic.slug_title end command :create_activity, @channel.created_by, :added_fact_to_channel, @fact, @channel
Fix adding of top topic to site, use slug_title instead of id
diff --git a/db/migrate/20170301101006_add_ci_runner_namespaces.rb b/db/migrate/20170301101006_add_ci_runner_namespaces.rb index abc1234..def5678 100644 --- a/db/migrate/20170301101006_add_ci_runner_namespaces.rb +++ b/db/migrate/20170301101006_add_ci_runner_namespaces.rb @@ -2,8 +2,6 @@ include Gitlab::Database::MigrationHelpers DOWNTIME = false - - disable_ddl_transaction! def change create_table :ci_runner_namespaces do |t|
Remove unnecessary disable transaction in add_ci_runner_namespaces
diff --git a/Library/Formula/tokyo-tyrant.rb b/Library/Formula/tokyo-tyrant.rb index abc1234..def5678 100644 --- a/Library/Formula/tokyo-tyrant.rb +++ b/Library/Formula/tokyo-tyrant.rb @@ -5,7 +5,7 @@ # Also it appears the Ruby (Rufus) bindings will only work with up to 1.1.33 url 'http://1978th.net/tokyotyrant/tokyotyrant-1.1.33.tar.gz' homepage 'http://1978th.net/tokyotyrant/' - md5 '48b153ed85b5f7057eedd3ce304eca34' + md5 '880d6af48458bc04b993bdae6ecc543d' depends_on 'tokyo-cabinet' depends_on 'lua'
Use the correct md5, why not?
diff --git a/hyperloop.rb b/hyperloop.rb index abc1234..def5678 100644 --- a/hyperloop.rb +++ b/hyperloop.rb @@ -8,17 +8,26 @@ def start loop do - socket = @server.accept + @socket = @server.accept + read_data_from_socket + send_response + close_socket + end + end - data = socket.readpartial 1024 - puts data + def read_data_from_socket + data = @socket.readpartial 1024 + puts data + end - socket.write "HTTP/1.1 200 OK\r\n" - socket.write "\r\n" - socket.write "w00t\n" + def send_response + @socket.write "HTTP/1.1 200 OK\r\n" + @socket.write "\r\n" + @socket.write "w00t\n" + end - socket.close - end + def close_socket + @socket.close end end
Refactor server processing a little bit
diff --git a/core/db/migrate/20131118183431_add_line_item_id_to_spree_inventory_units.rb b/core/db/migrate/20131118183431_add_line_item_id_to_spree_inventory_units.rb index abc1234..def5678 100644 --- a/core/db/migrate/20131118183431_add_line_item_id_to_spree_inventory_units.rb +++ b/core/db/migrate/20131118183431_add_line_item_id_to_spree_inventory_units.rb @@ -5,10 +5,12 @@ add_column :spree_inventory_units, :line_item_id, :integer add_index :spree_inventory_units, :line_item_id - Spree::Shipment.includes(:inventory_units, :order).find_each do |shipment| - shipment.inventory_units.group_by(&:variant).each do |variant, units| + shipments = Spree::Shipment.includes(:inventory_units, :order) - line_item = shipment.order.find_line_item_by_variant(variant) + shipments.find_each do |shipment| + shipment.inventory_units.group_by(&:variant_id).each do |variant, units| + + line_item = shipment.order.line_items.find_by(variant_id: variant_id) next unless line_item Spree::InventoryUnit.where(id: units.map(&:id)).update_all(line_item_id: line_item.id)
Make migration more tolerant of deleted Variants This migration bailed for me when it found an old order (before Spree used `acts_as_paranoid`) with a line_item referencing a Variant that no longer existed. Making the migration use `variant_id` instead of `variant.id` fixed this problem for me, and I suspect will make the migration path smoother for other people who have been using Spree since before the `paranoia` gem. Fixes #4822
diff --git a/smoke_test.rb b/smoke_test.rb index abc1234..def5678 100644 --- a/smoke_test.rb +++ b/smoke_test.rb @@ -1,5 +1,6 @@ #!/usr/bin/env ruby +require 'date' require 'faraday' domain = 'https://www.pensionwise.gov.uk'
Add missing dependency on Date
diff --git a/Casks/fontexplorer-x-pro.rb b/Casks/fontexplorer-x-pro.rb index abc1234..def5678 100644 --- a/Casks/fontexplorer-x-pro.rb +++ b/Casks/fontexplorer-x-pro.rb @@ -1,6 +1,6 @@ cask :v1 => 'fontexplorer-x-pro' do - version '5.0.1' - sha256 'e75369d862a186a75dcbb9d0f61a5f99f03bd1482de02f3e71ffaa29a0828b9c' + version '5.0.2' + sha256 'ef86771fb2acf2eaa3c30b72d51594eda4ab2cd4c9a7454585184460d49b043a' url "http://fast.fontexplorerx.com/FontExplorerXPro#{version.delete('.')}.dmg" name 'FontExplorer X Pro'
Upgrade FontExplorer X Pro.app to v5.0.2
diff --git a/rack-pretty_json.gemspec b/rack-pretty_json.gemspec index abc1234..def5678 100644 --- a/rack-pretty_json.gemspec +++ b/rack-pretty_json.gemspec @@ -18,6 +18,7 @@ s.require_paths = ["lib"] s.add_dependency 'rack', '>=1.0.0' + s.add_dependency "json" s.add_development_dependency 'rake'
Add "json" as a dependency
diff --git a/QASwipeSelector.podspec b/QASwipeSelector.podspec index abc1234..def5678 100644 --- a/QASwipeSelector.podspec +++ b/QASwipeSelector.podspec @@ -0,0 +1,29 @@+Pod::Spec.new do |s| + +# Library description + s.name = 'QASwipeSelector' + s.version = '0.0.1' + s.author = { 'Quentin ARNAULT' => 'quentin.arnault@gmail.com' } + s.license = { + :type => 'MIT', + :text => 'MIT Licence' + } + s.homepage = 'https://github.com/QuentinArnault/QASwipeSelector' + s.summary = 'QASwipeSelector is a new graphical component which offers the possibility to swipe between items.' + s.description = <<-DESC + QASwipeSelector is a new graphical component which offers the possibility to swipe between items. + DESC + s.source = { + :git => 'https://github.com/QuentinArnault/QASwipeSelector.git', + :branch => 'develop' + } + s.source_files = 'QASwipeSelector/QASwipeSelector/*.{h,m}' + +# Platform setup + s.platform = :ios, '7.0' + s.ios.deployment_target = '7.0' + s.requires_arc = true + +# Subspecs + +end
IMPLEMENT add a pod spec
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 @@ -30,9 +30,9 @@ def redirect_to_back(default = root_url) if request.env["HTTP_REFERER"].present? and request.env["HTTP_REFERER"] != request.env["REQUEST_URI"] - redirect_to :back + :back else - redirect_to default + default end end end
Remove second call to redirect_to
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 @@ -1,3 +1,20 @@ class ApplicationController < ActionController::Base protect_from_forgery + + private + + def current_user + # TODO: Fix this after authentication is done + @current_user ||= User.first || User.create #User.find(session[:user_id]) if session[:user_id] + end + + def require_user + redirect_to root_url, alert: 'You must be logged in to access this area.' unless current_user + end + + def require_admin + redirect_to root_url, alert: 'You must be an admin to access this area.' unless current_user.try(:admin?) + end + + helper_method :current_user end
Add some shared methods for dealing with users (stubbed out for current_user)