diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/app/controllers/api/v1/dependencies_controller.rb b/app/controllers/api/v1/dependencies_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/dependencies_controller.rb +++ b/app/controllers/api/v1/dependencies_controller.rb @@ -21,7 +21,7 @@ return render plain: "" if gem_names.empty? return if gem_names.size <= GEM_REQUEST_LIMIT - case request.format + case request.format.symbol when :marshal render plain: "Too many gems! (use --full-index instead)", status: :unprocessable_entity when :json
Use symbol to match request format request.format returns format string, ex: "application/json"
diff --git a/app/models/bibliographer/chapter.rb b/app/models/bibliographer/chapter.rb index abc1234..def5678 100644 --- a/app/models/bibliographer/chapter.rb +++ b/app/models/bibliographer/chapter.rb @@ -1,6 +1,6 @@ class Bibliographer::Chapter < Bibliographer::Base def to_s - "#{names}, '#{title}' in |#{book_title}|, ed. by #{editor_names} (#{pub_place}: #{publisher}, #{year}) pp. #{pages}" + "#{names}, '#{title}' in |#{book_title}|, ed. by #{editor_names} (#{pub_place}: #{publisher}, #{year}), pp. #{pages}" end def book_title
Add a comma before page numbers
diff --git a/app/models/world_record_observer.rb b/app/models/world_record_observer.rb index abc1234..def5678 100644 --- a/app/models/world_record_observer.rb +++ b/app/models/world_record_observer.rb @@ -13,6 +13,6 @@ def delete_page_cache(page) page_file = Rails.public_path.join page - File.delete(page_file) if File.exist? page_file + FileUtils.rm_rf(page_file) end end
Use FilUtis.rm_rf ti delete instead of checking if file exists
diff --git a/Casks/logitech-gaming-software.rb b/Casks/logitech-gaming-software.rb index abc1234..def5678 100644 --- a/Casks/logitech-gaming-software.rb +++ b/Casks/logitech-gaming-software.rb @@ -1,13 +1,13 @@ cask 'logitech-gaming-software' do - version '8.53.10' - sha256 '60ce2aacf33ab523333328128ce96239e6e4bb90f6100d1d7d3d40fce28185a9' + version '8.60.313' + sha256 'f83d5c573fc4236454471158d88153cb970996211b1cbd27180f906fccc7d9c1' - url "http://www.logitech.com/pub/techsupport/gaming/LogiGamingSetup_#{version}.mpkg" + url "http://download01.logitech.com/web/ftp/pub/techsupport/gaming/LogitechSetup_#{version}.zip" name 'Logitech Gaming Software' - homepage 'http://www.logitech.com/en-us/support/gaming-software?section=downloads&bit=&osid=36' + homepage 'http://support.logitech.com/en_us/downloads' license :unknown # TODO: change license and remove this comment; ':unknown' is a machine-generated placeholder - pkg "LogiGamingSetup_#{version}.mpkg" + pkg 'LogiGamingSetup.mpkg' uninstall :script => '/Applications/Logitech/Uninstaller.app/Contents/Resources/UninstallScript.sh', :pkgutil => [
Upgrade Logitech Gaming Software to 8.60.313
diff --git a/conditional_counter_cache.gemspec b/conditional_counter_cache.gemspec index abc1234..def5678 100644 --- a/conditional_counter_cache.gemspec +++ b/conditional_counter_cache.gemspec @@ -17,7 +17,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency "activerecord" + spec.add_dependency "activerecord", ">= 4.0.0", "< 4.2.0" spec.add_dependency "activesupport" spec.add_development_dependency "bundler", "~> 1.7" spec.add_development_dependency "rails"
Fix supported ActiveRecord version as `[4.0.0, 4.2.0)` BelongsTo's implementation will be changed in v4.2.0
diff --git a/parsley_simple_form.gemspec b/parsley_simple_form.gemspec index abc1234..def5678 100644 --- a/parsley_simple_form.gemspec +++ b/parsley_simple_form.gemspec @@ -6,10 +6,10 @@ Gem::Specification.new do |spec| spec.name = "parsley_simple_form" spec.version = ParsleySimpleForm::VERSION - spec.authors = ["Matheus Caceres"] - spec.email = ["matheus@formaweb.com.br"] - spec.description = %q{TODO: Write a gem description} - spec.summary = %q{TODO: Write a gem summary} + spec.authors = ["Matheus Cáceres", "Caio Tarifa"] + spec.email = "contato@formaweb.com.br" + spec.description = "ParsleyJS for Simple Form and Rails" + spec.summary = "ParsleyJS for Simple Form and Rails" spec.homepage = "" spec.license = "MIT" @@ -18,6 +18,8 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.add_dependency("simple_form") + spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" end
Add authors for gemspect; Add simple_form dependency for gemspec
diff --git a/feedback.gemspec b/feedback.gemspec index abc1234..def5678 100644 --- a/feedback.gemspec +++ b/feedback.gemspec @@ -7,11 +7,11 @@ Gem::Specification.new do |s| s.name = "feedback" s.version = Feedback::VERSION - s.authors = ["TODO: Your name"] - s.email = ["TODO: Your email"] - s.homepage = "TODO" - s.summary = "TODO: Summary of Feedback." - s.description = "TODO: Description of Feedback." + s.authors = ["Phil, Rachel, Ryan"] + s.email = ["development.team@moneyadviceservice.org.uk"] + s.homepage = "http://www.moneyadviceservice.org.uk" + s.summary = "Allow visitors to submit feedback" + s.description = "" s.license = "MIT" s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
Add MAS details to gemspec
diff --git a/app/controllers/alexa_interface_controller.rb b/app/controllers/alexa_interface_controller.rb index abc1234..def5678 100644 --- a/app/controllers/alexa_interface_controller.rb +++ b/app/controllers/alexa_interface_controller.rb @@ -2,6 +2,7 @@ def recommend respond_to do |f| f.json { + p params render json: create_response({}) } end
Add p params to try to examine the object that alexa sends us
diff --git a/app/controllers/koi/application_controller.rb b/app/controllers/koi/application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/koi/application_controller.rb +++ b/app/controllers/koi/application_controller.rb @@ -6,6 +6,6 @@ include ExportableController include IsAdminController - helper Katalyst::GOVUK::FormBuilder::Frontend + helper Katalyst::GOVUK::Formbuilder::Frontend end end
Fix capitalisation of Formbuilder helper
diff --git a/spec/quality/reek_source_spec.rb b/spec/quality/reek_source_spec.rb index abc1234..def5678 100644 --- a/spec/quality/reek_source_spec.rb +++ b/spec/quality/reek_source_spec.rb @@ -2,6 +2,6 @@ describe 'Reek source code' do it 'has no smells' do - Dir['lib/**/*.rb'].should_not reek + expect(Dir['lib/**/*.rb']).to_not reek end end
Update quality spec to new rspec syntax
diff --git a/lib/appnexusapi/resource.rb b/lib/appnexusapi/resource.rb index abc1234..def5678 100644 --- a/lib/appnexusapi/resource.rb +++ b/lib/appnexusapi/resource.rb @@ -11,6 +11,7 @@ def update(route_params={}, body_params={}) resource = @service.update(id, route_params, body_params) @json = resource.raw_json + self end def delete(route_params={})
Return the Resource object instead of the updated JSON after updates
diff --git a/lib/rack/indicium/sentry.rb b/lib/rack/indicium/sentry.rb index abc1234..def5678 100644 --- a/lib/rack/indicium/sentry.rb +++ b/lib/rack/indicium/sentry.rb @@ -14,13 +14,11 @@ end def call(env) - check_for_jwt(env) + check_for_jwt(env) if enabled? @app.call(env) end def check_for_jwt(env) - return unless enabled? - context = { "jwt.header" => env["jwt.header"], "jwt.payload" => env["jwt.payload"],
Refactor: Check as early as possible if we should handle JWT
diff --git a/lib/we_the_people/simple.rb b/lib/we_the_people/simple.rb index abc1234..def5678 100644 --- a/lib/we_the_people/simple.rb +++ b/lib/we_the_people/simple.rb @@ -0,0 +1,38 @@+module WeThePeople + class Simple + class <<self + def petitions(criteria = {}) + get("petitions.json", criteria) + end + + def petition(id) + get("petitions/#{id}.json").first + end + + def signatures(petition_id, criteria = {}) + get("petitions/#{petition_id}/signatures.json", criteria) + end + + def signature(petition_id, signature_id) + get("petitions/#{petition_id}/signatures/#{signature_id}.json").first + end + + def users(criteria = {}) + get("users.json", criteria) + end + + def user(id) + get("users/#{id}.json").first + end + + def url(path) + "#{WeThePeople.host}/#{path}" + end + + def get(path, params = {}) + response = WeThePeople.client.get(url(path), :params => params.merge(WeThePeople.default_params)) + JSON.parse(response.body)['results'] + end + end + end +end
Add WeThePeople::Simple for simply accessing resources
diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index abc1234..def5678 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -8,14 +8,14 @@ p.font_src :self, :https, :data p.img_src :self, :https, :data p.object_src :none - p.script_src :self, :https + p.script_src :self, :https, :unsafe_eval p.style_src :self, :https, :unsafe_inline else p.default_src :self, :http p.font_src :self, :http, :data p.img_src :self, :http, :data p.object_src :none - p.script_src :self, :http + p.script_src :self, :http, :unsafe_eval p.style_src :self, :http, :unsafe_inline end
Allow unsafe_eval in CSP for script_src
diff --git a/lib/awspec/type/iam_role.rb b/lib/awspec/type/iam_role.rb index abc1234..def5678 100644 --- a/lib/awspec/type/iam_role.rb +++ b/lib/awspec/type/iam_role.rb @@ -7,7 +7,7 @@ end def id - @id ||= resource_via_client.role_id if resource_via_client + @id ||= resource_via_client.role_name if resource_via_client end def has_iam_policy?(policy_id)
Change Awspec::Type::IamRole.id from role_id to role_name Because Aws::IAM::Role initialize using role_name
diff --git a/lib/chrono_model/railtie.rb b/lib/chrono_model/railtie.rb index abc1234..def5678 100644 --- a/lib/chrono_model/railtie.rb +++ b/lib/chrono_model/railtie.rb @@ -12,5 +12,30 @@ task 'db:schema:load' => 'db:chrono:create_schemas' end + + class SchemaDumper < ::ActiveRecord::SchemaDumper + def tables(*) + super + @connection.send(:_on_temporal_schema) { super } + end + + def indexes(table, stream) + super + if @connection.is_chrono?(table) + stream.rewind + t = stream.read.sub(':force => true', '\&, :temporal => true') # HACK + stream.seek(0) + stream.truncate(0) + stream.write(t) + end + end + + end + + # I'm getting (too) used to this (dirty) override scheme. + # + silence_warnings do + ::ActiveRecord::SchemaDumper = SchemaDumper + end end end
Implement an overly hacky schema dumper for temporal tables
diff --git a/lib/readingtime/core_ext.rb b/lib/readingtime/core_ext.rb index abc1234..def5678 100644 --- a/lib/readingtime/core_ext.rb +++ b/lib/readingtime/core_ext.rb @@ -7,10 +7,10 @@ seconds = Readingtime.seconds(word_size) case format_options - when :basic - Readingtime.format_seconds((minutes + seconds)) - when :long - Readingtime.format_words((minutes + seconds)) + when :basic + Readingtime.format_seconds((minutes + seconds)) + when :long + Readingtime.format_words((minutes + seconds)) end end
Indent when as much as case
diff --git a/lib/patronus_fati/data_models/common_state.rb b/lib/patronus_fati/data_models/common_state.rb index abc1234..def5678 100644 --- a/lib/patronus_fati/data_models/common_state.rb +++ b/lib/patronus_fati/data_models/common_state.rb @@ -14,7 +14,7 @@ end def new? - sync_status == SYNC_FLAGS[:unsynced] + sync_status & (SYNC_FLAGS[:syncedOnline] | SYNC_FLAGS[:syncedOffline]) > 0 end def mark_synced
Fix new check to ignore child & attributes, we only care if it's been synced of not
diff --git a/lib/sync_checker/formats/publication_check.rb b/lib/sync_checker/formats/publication_check.rb index abc1234..def5678 100644 --- a/lib/sync_checker/formats/publication_check.rb +++ b/lib/sync_checker/formats/publication_check.rb @@ -0,0 +1,65 @@+module SyncChecker + module Formats + class PublicationCheck < EditionBase + def root_path + "/government/publications/" + end + + def checks_for_live(locale) + super + [ + Checks::LinksCheck.new( + "document_collections", + edition_expected_in_live + .document_collections + .published + .map(&:content_id) + ), + Checks::LinksCheck.new( + "ministers", + edition_expected_in_live + .role_appointments + .joins(:person) + .pluck("people.content_id") + ), + Checks::LinksCheck.new( + "related_statistical_data_sets", + edition_expected_in_live + .statistical_data_sets + .map(&:content_id) + ), + Checks::LinksCheck.new( + "topical_events", + ::TopicalEvent + .joins(:classification_memberships) + .where(classification_memberships: {edition_id: edition_expected_in_live.id}) + .pluck(:content_id) + ), + Checks::LinksCheck.new( + "children", + edition_expected_in_live + .html_attachments + .pluck(:content_id) + ) + ] + end + + def document_type + edition_expected_in_live.publication_type.key + end + + def expected_details_hash(edition) + super.tap do |expected_details_hash| + expected_details_hash.merge( + documents: Whitehall::GovspeakRenderer.new.block_attachments(edition.attachments) + ) if edition.attachments.any? + end + end + + private + + def rendering_app + Whitehall::RenderingApp::WHITEHALL_FRONTEND + end + end + end +end
Add sync checker for Publications
diff --git a/lib/tasks/custom_tests.rake b/lib/tasks/custom_tests.rake index abc1234..def5678 100644 --- a/lib/tasks/custom_tests.rake +++ b/lib/tasks/custom_tests.rake @@ -0,0 +1,15 @@+# Adding test/parsers directory to rake test. +namespace :test do + desc "Test custom/tests/* code" + Rails::TestTask.new(custom: 'test:prepare') do |t| + t.pattern = 'custom/test/**/*_test.rb' + end + + desc "Test ../custom/tests/* code" + Rails::TestTask.new(custom_ext: 'test:prepare') do |t| + t.pattern = '../custom/test/**/*_test.rb' + end +end + +Rake::Task['test:run'].enhance ["test:custom"] +Rake::Task['test:run'].enhance ["test:custom_ext"]
Update to support custom tests
diff --git a/Casks/firefoxdeveloperedition-ja.rb b/Casks/firefoxdeveloperedition-ja.rb index abc1234..def5678 100644 --- a/Casks/firefoxdeveloperedition-ja.rb +++ b/Casks/firefoxdeveloperedition-ja.rb @@ -5,6 +5,7 @@ url "https://download.mozilla.org/?product=firefox-aurora-latest-l10n&os=osx&lang=ja-JP-mac" homepage 'https://www.mozilla.org/ja/firefox/developer/' license :mpl + tags :vendor => 'Mozilla' app 'FirefoxDeveloperEdition.app' end
Add tag stanza to Firefox Developer Edition JA
diff --git a/XCDYouTubeVideoPlayerViewController.podspec b/XCDYouTubeVideoPlayerViewController.podspec index abc1234..def5678 100644 --- a/XCDYouTubeVideoPlayerViewController.podspec +++ b/XCDYouTubeVideoPlayerViewController.podspec @@ -1,13 +1,15 @@ Pod::Spec.new do |s| - s.name = "XCDYouTubeVideoPlayerViewController" - s.version = "1.1.1" - s.summary = "YouTube video player for iPhone and iPad." - s.homepage = "https://github.com/0xced/XCDYouTubeVideoPlayerViewController" - s.license = 'MIT' - s.author = { "Cédric Luthi" => "cedric.luthi@gmail.com" } - s.source = { :git => "https://github.com/0xced/XCDYouTubeVideoPlayerViewController.git", :tag => s.version.to_s } - s.platform = :ios, '5.0' - s.source_files = 'XCDYouTubeVideoPlayerViewController' - s.frameworks = 'AVFoundation', 'MediaPlayer' - s.requires_arc = true + s.name = "XCDYouTubeVideoPlayerViewController" + s.version = "1.1.1" + s.summary = "YouTube video player for iPhone and iPad." + s.homepage = "https://github.com/0xced/XCDYouTubeVideoPlayerViewController" + s.screenshot = "https://raw.github.com/0xced/XCDYouTubeVideoPlayerViewController/#{s.version}/Screenshots/XCDYouTubeVideoPlayerViewController.png" + s.license = { :type => "MIT", :file => "LICENSE" } + s.author = { "Cédric Luthi" => "cedric.luthi@gmail.com" } + s.social_media_url = "https://twitter.com/0xced" + s.source = { :git => "https://github.com/0xced/XCDYouTubeVideoPlayerViewController.git", :tag => s.version.to_s } + s.platform = :ios, "5.0" + s.source_files = "XCDYouTubeVideoPlayerViewController" + s.frameworks = "AVFoundation", "MediaPlayer" + s.requires_arc = true end
Add screenshot, social media URL and license file in podspec
diff --git a/lib/unveil/rails/railtie.rb b/lib/unveil/rails/railtie.rb index abc1234..def5678 100644 --- a/lib/unveil/rails/railtie.rb +++ b/lib/unveil/rails/railtie.rb @@ -1,4 +1,4 @@-require 'unveil/rails/view_helpers' +require 'unveil/rails/view_helper' module Unveil class Rails
Fix require statement in Unveil::Rails::Railtie
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -2,6 +2,10 @@ configure do set :wsrep_state_dir, '/etc/mysql/wsrep' +end + +configure :development do + set :wsrep_state_dir, 'spec/data/3_node_cluster_synced' end get '/' do
Configure a sane dev default
diff --git a/engines/debug/steps/text.rb b/engines/debug/steps/text.rb index abc1234..def5678 100644 --- a/engines/debug/steps/text.rb +++ b/engines/debug/steps/text.rb @@ -41,7 +41,7 @@ end def rewrite(what) - replace(@env["rewrite_#{what}_matcher"], @env["rewrite_#{what}_to"] + @env["proxy_domain"]) + @object.gsub!(Regexp.new(@env["rewrite_#{what}_matcher"]), @env["rewrite_#{what}_to"] + @env["proxy_domain"]) end end end
Use a faster version of rewrite.
diff --git a/gem_config.rb b/gem_config.rb index abc1234..def5678 100644 --- a/gem_config.rb +++ b/gem_config.rb @@ -1,5 +1,3 @@-require 'English' - # gem_config.rb - This script is executed by the gem command # to generate the RMagick Makefile. Ref: rmagick.gemspec @@ -8,14 +6,19 @@ args = [] ARGV.each { |arg| args << arg if arg =~ /\A--/ } -cmd = "sh configure #{args.join(' ')} 2>&1" +cmd = "sh configure #{args.join(' ')}" puts "\n#{cmd}\n\n" -IO.popen(cmd) { |pipe| while s = pipe.gets : puts s; end } - -code = $CHILD_STATUS ? $CHILD_STATUS.exitstatus : 0 +rc = system(cmd) # The gem command wants some output on stdout. Tell gem what happened. -puts "RMagick configure returned #{code}" -exit code +if rc + puts "RMagick configuration completed successfully" + rc = 0 +else + puts "RMagick configuration completed with status #{$?.exitstatus}" + rc = $?.exitstatus +end +exit rc +
Replace popen with a simple call to system
diff --git a/app/controllers/registrant/domain_update_confirms_controller.rb b/app/controllers/registrant/domain_update_confirms_controller.rb index abc1234..def5678 100644 --- a/app/controllers/registrant/domain_update_confirms_controller.rb +++ b/app/controllers/registrant/domain_update_confirms_controller.rb @@ -5,10 +5,10 @@ def show @domain = Domain.find(params[:id]) - if @domain.present? && params[:token].present? && @domain.registrant_verification_token == params[:token] - else - @domain = nil - end + # if @domain.present? && params[:token].present? && @domain.registrant_verification_token == params[:token] + # else + # @domain = nil + # end end def create
Comment out domain confirms for temp
diff --git a/HanlyKit.podspec b/HanlyKit.podspec index abc1234..def5678 100644 --- a/HanlyKit.podspec +++ b/HanlyKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "HanlyKit" - s.version = "0.0.1" + s.version = "0.0.2" s.summary = "A common Kit used on iOS." s.description = <<-DESC It is a common Kit used on iOS, which implement by Objective-C.
Update pod spec version 0.0.2
diff --git a/week-6/die-2/my_solution.rb b/week-6/die-2/my_solution.rb index abc1234..def5678 100644 --- a/week-6/die-2/my_solution.rb +++ b/week-6/die-2/my_solution.rb @@ -20,20 +20,19 @@ # Initial Solution class Die - def initialize(sides) - if not sides.empty? - @sides = sides + attr_reader :labels, :sides + + def initialize(labels) + if not labels.empty? + @labels = labels + @sides = labels.size else raise ArgumentError.new("need more sides bub") end end - def sides - @sides.size - end - def roll - p @sides[rand(sides)] + labels[rand(sides)] end end @@ -42,22 +41,16 @@ # Refactored Solution class Die - attr_reader :sides + attr_reader :labels, :sides - def initialize(sides) - unless sides.empty? - @sides = sides - else - raise ArgumentError.new("need more sides bub") - end - end - - def sides - @sides.size + def initialize(labels) + @labels = labels + @sides = labels.size + raise ArgumentError.new("need more sides bub") if @labels.empty? end def roll - p @sides.at(rand(sides)) + labels.sample end end
Fix initial code to fit pseudocode, refactor code
diff --git a/api/app/views/spree/api/images/show.v1.rabl b/api/app/views/spree/api/images/show.v1.rabl index abc1234..def5678 100644 --- a/api/app/views/spree/api/images/show.v1.rabl +++ b/api/app/views/spree/api/images/show.v1.rabl @@ -1,3 +1,4 @@ object @image attributes *image_attributes attributes :viewable_type, :viewable_id +node(:attachment_url) { |i| i.attachment.to_s }
[api] Return relative attachment url for product images
diff --git a/app/controllers/api/customers_controller.rb b/app/controllers/api/customers_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/customers_controller.rb +++ b/app/controllers/api/customers_controller.rb @@ -11,11 +11,15 @@ @customer = Customer.find(params[:id]) authorize! :update, @customer - if @customer.update(params[:customer]) + if @customer.update(customer_params) render json: @customer, serializer: CustomerSerializer, status: :ok else invalid_resource!(@customer) end end + + def customer_params + params.require(:customer).permit(:code, :email, :enterprise_id, :allow_charges) + end end end
Fix credit cards strong params
diff --git a/app/controllers/api/v1/events_controller.rb b/app/controllers/api/v1/events_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/events_controller.rb +++ b/app/controllers/api/v1/events_controller.rb @@ -13,7 +13,8 @@ end def create - event = Event.create(event_params) + cause = Cause.find_by_id(params[:cause_id]) + event = cause.events.create(event_params) if event.save render json: event else
Add cause id to event params in event controller
diff --git a/lib/gembeat.rb b/lib/gembeat.rb index abc1234..def5678 100644 --- a/lib/gembeat.rb +++ b/lib/gembeat.rb @@ -9,13 +9,21 @@ def self.setup! config = YAML.load_file("#{Rails.root.to_s}/config/gembeat.yml") - self.token = config["token"] - self.pulse_url = config["pulse_url"] + + if config["token"] && config["pulse_url"] + self.token = config["token"] + self.pulse_url = config["pulse_url"] + true + else + puts "[Gembeat] Config file not found, you will need to manually initialize and send a pulse." + false + end end def self.setup_and_send_pulse! - self.setup! - self.send_pulse + if self.setup! + self.send_pulse + end end def self.specs
Add message if uninitialized config
diff --git a/Formula/percona-toolkit.rb b/Formula/percona-toolkit.rb index abc1234..def5678 100644 --- a/Formula/percona-toolkit.rb +++ b/Formula/percona-toolkit.rb @@ -3,7 +3,7 @@ class PerconaToolkit < Formula homepage 'http://www.percona.com/software/percona-toolkit/' url 'http://www.percona.com/redir/downloads/percona-toolkit/2.1.1/percona-toolkit-2.1.1.tar.gz' - md5 '14be6a3e31c7b20aeca78e3e0aed6edc' + sha1 'bbaf2440c55bb62b5e98d08bd3246e82c84f6f2a' depends_on 'Time::HiRes' => :perl depends_on 'DBD::mysql' => :perl
percona: Use SHA1 instead of MD5 Signed-off-by: Adam Vandenberg <34c2b6407fd5a10249a15d699d40f9ed1782e98c@gmail.com>
diff --git a/lib/rubella.rb b/lib/rubella.rb index abc1234..def5678 100644 --- a/lib/rubella.rb +++ b/lib/rubella.rb @@ -7,21 +7,33 @@ def initialize(input_name, output_name, weighting_name) + # set the input type @input = case input_name + # add the option to set input later + when nil then + nil when "json" then self.input_json else raise NotImplementedError, "Not supported input type "+input_name+" given" end + # set the output type @output = case output_name + # add the option to set the output later + when nil then + nil when "image" then self.output_image else raise NotImplementedError, "Not supported output type "+output_name+" given" end + # set the weighting @weighting = case weighting_name + # add the option to set the weighting later + when nil then + nil when "per_value" then self.weighting_per_value when "per_overall_load" then
Make it almost possible to decide input, output and weighting later It is not possible to choose something differen, if it's nil. But you can choose nil.
diff --git a/config/initializers/_patch-GHSA-65cv-r6x7-79hv.rb b/config/initializers/_patch-GHSA-65cv-r6x7-79hv.rb index abc1234..def5678 100644 --- a/config/initializers/_patch-GHSA-65cv-r6x7-79hv.rb +++ b/config/initializers/_patch-GHSA-65cv-r6x7-79hv.rb @@ -0,0 +1,27 @@+# Patch from https://github.com/net1957/ProxyCheck/network/alert/Gemfile.lock/actionview/open +# correct bug GHSA-65cv-r6x7-79hv in rails 5.1 +# Corrected in Rails 5.2.4.2 and 6.0.2.2 +# Supress this file if you install Rails greater than 5.2.4.2 or 6.0.2.2 +ActionView::Helpers::JavaScriptHelper::JS_ESCAPE_MAP.merge!( + { + "`" => "\\`", + "$" => "\\$" + } +) + +module ActionView::Helpers::JavaScriptHelper + alias :old_ej :escape_javascript + alias :old_j :j + + def escape_javascript(javascript) + javascript = javascript.to_s + if javascript.empty? + result = "" + else + result = javascript.gsub(/(\\|<\/|\r\n|\342\200\250|\342\200\251|[\n\r"']|[`]|[$])/u, JS_ESCAPE_MAP) + end + javascript.html_safe? ? result.html_safe : result + end + + alias :j :escape_javascript +end
Patch for GHSA-65cv-r6x7-79hv in Rails 5.1
diff --git a/lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb b/lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb index abc1234..def5678 100644 --- a/lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb +++ b/lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb @@ -9,7 +9,11 @@ t.string :resource_id, null: false t.string :resource_type, null: false t.references :author, polymorphic: true - t.timestamps + if Rails::VERSION::MAJOR >= 5 + t.timestamps + else + t.timestamps null: false + end end add_index :active_admin_comments, [:namespace]
Fix warning in Rails 4: adopt Rails 5 behaviour ``` DEPRECATION WARNING: `#timestamps` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. ```
diff --git a/hutch.gemspec b/hutch.gemspec index abc1234..def5678 100644 --- a/hutch.gemspec +++ b/hutch.gemspec @@ -6,7 +6,7 @@ gem.add_runtime_dependency 'march_hare', '>= 3.0.0' else gem.platform = Gem::Platform::RUBY - gem.add_runtime_dependency 'bunny', '>= 2.7.2' + gem.add_runtime_dependency 'bunny', '~> 2.9.0' end gem.add_runtime_dependency 'carrot-top', '~> 0.0.7' gem.add_runtime_dependency 'multi_json', '~> 1.12' @@ -17,7 +17,7 @@ gem.description = 'Hutch is a Ruby library for enabling asynchronous ' \ 'inter-service communication using RabbitMQ.' gem.version = Hutch::VERSION.dup - gem.required_ruby_version = '>= 2.0' + gem.required_ruby_version = '>= 2.2' gem.authors = ['Harry Marr'] gem.email = ['developers@gocardless.com'] gem.homepage = 'https://github.com/gocardless/hutch'
Bump Bunny to ~> 2.9.0; require Ruby 2.2+ Which in turn will depend on amp-protocol 2.3.x. Earlier Bunny versions won't work with that amp-protocol release series. Note that it also bumps minimum supported Ruby version to 2.2, which over 3 years old. See ruby-amqp/bunny#538 and Bunny change log for details.
diff --git a/cookbooks/networking/libraries/ipaddresses.rb b/cookbooks/networking/libraries/ipaddresses.rb index abc1234..def5678 100644 --- a/cookbooks/networking/libraries/ipaddresses.rb +++ b/cookbooks/networking/libraries/ipaddresses.rb @@ -5,6 +5,8 @@ interfaces(options).each do |interface| address = interface[:public_address] || interface[:address] + + next if address.nil? if block.nil? addresses << address
Handle interfaces with no address
diff --git a/November.podspec b/November.podspec index abc1234..def5678 100644 --- a/November.podspec +++ b/November.podspec @@ -16,7 +16,8 @@ spec.author = "Manuel García-Estañ" spec.social_media_url = "http://twitter.com/ManueGE" - spec.platform = :ios, "8.0" + spec.ios.deployment_target = '8.0' + spec.osx.deployment_target = '10.13' spec.source = { :git => "https://github.com/ManueGE/November.git", :tag => "#{spec.version}" } spec.requires_arc = true
Add macOS as a target
diff --git a/db/migrate/20130215185809_fix_condition_on_rule_occurrences_set_latest.rb b/db/migrate/20130215185809_fix_condition_on_rule_occurrences_set_latest.rb index abc1234..def5678 100644 --- a/db/migrate/20130215185809_fix_condition_on_rule_occurrences_set_latest.rb +++ b/db/migrate/20130215185809_fix_condition_on_rule_occurrences_set_latest.rb @@ -0,0 +1,25 @@+class FixConditionOnRuleOccurrencesSetLatest < ActiveRecord::Migration + def up + execute <<-SQL + CREATE OR REPLACE RULE occurrences_set_latest AS + ON INSERT TO occurrences DO + UPDATE bugs + SET latest_occurrence = NEW.occurred_at + WHERE (bugs.id = NEW.bug_id) + AND ((bugs.latest_occurrence IS NULL) + OR (bugs.latest_occurrence < NEW.occurred_at)) + SQL + end + + def down + execute <<-SQL + CREATE OR REPLACE RULE occurrences_set_latest AS + ON INSERT TO occurrences DO + UPDATE bugs + SET latest_occurrence = NEW.occurred_at + WHERE (bugs.id = NEW.bug_id) + AND (bugs.latest_occurrence IS NULL) + OR (bugs.latest_occurrence < NEW.occurred_at) + SQL + end +end
Fix the condition portion on the set latest rule.
diff --git a/config/initializers/core_ext/active_record.rb b/config/initializers/core_ext/active_record.rb index abc1234..def5678 100644 --- a/config/initializers/core_ext/active_record.rb +++ b/config/initializers/core_ext/active_record.rb @@ -0,0 +1,25 @@+module Elasticsearch + module Model + module Adapter + module ActiveRecord + module Records + def records + sql_records = klass.where(klass.primary_key => ids) + sql_records = sql_records.includes(self.options[:includes]) if self.options[:includes] + sql_records.instance_exec(response.response['hits']['hits']) do |hits| + define_singleton_method :records do + if defined?(::ActiveRecord) && ::ActiveRecord::VERSION::MAJOR >= 4 + self.load + else + self.__send__(:exec_queries) + end + @records.sort_by { |record| hits.index { |hit| hit['_id'].to_s == record.id.to_s } } + end + end + sql_records + end + end + end + end + end +end
Patch elasticsearch-model for Rails 5.
diff --git a/cookbooks/bcpc-hadoop/recipes/oozie_client.rb b/cookbooks/bcpc-hadoop/recipes/oozie_client.rb index abc1234..def5678 100644 --- a/cookbooks/bcpc-hadoop/recipes/oozie_client.rb +++ b/cookbooks/bcpc-hadoop/recipes/oozie_client.rb @@ -13,7 +13,7 @@ hdp_select('oozie-client', node[:bcpc][:hadoop][:distribution][:active_release]) oozie_url = "http://#{node[:bcpc][:management][:vip]}:" + - node[:bcpc][:hadoop][:oozie_port].to_s + node[:bcpc][:hadoop][:oozie_port].to_s + '/oozie' file '/etc/profile.d/oozie-url.sh' do mode 0555
Add the correct oozie prefix to the VIP URL
diff --git a/spec/functional/coffeeshop_functional_spec.rb b/spec/functional/coffeeshop_functional_spec.rb index abc1234..def5678 100644 --- a/spec/functional/coffeeshop_functional_spec.rb +++ b/spec/functional/coffeeshop_functional_spec.rb @@ -0,0 +1,34 @@+require 'spec_helper' + +describe 'Coffeeshop functional spec' do + specify 'starting to make our first coffeeshop' do + tag = Tag.new(name: 'coffeeshop', required_fields: [ + {name: 'name', type: 'string'}, + {name: 'address', type: 'string'}, + {name: 'phone_number', type: 'string'} + ], optional_fields: [ + {name: 'url', type: 'string'} + ]) + + wifi_tag = Tag.new(name: 'wifi', required_fields: [ + {name: 'free', type: 'boolean'} + ], optional_fields: [ + {name: 'token', type: 'boolean'}, + {name: 'time_limited', type: 'boolean'} + ]) + + indie_coffee = Thing.new( + tags: %w(coffeeshop wifi), + coffeeshop: { + name: 'Indie Coffee', + address: '1225 Regent St, Madison, WI 53715', + phone_number: '608-259-9621', + }, + wifi: { + free: true + } + ) + + expect(indie_coffee.coffeeshop[:name]).to eq('Indie Coffee') + end +end
Add functional test for coffeeshops
diff --git a/Formula/ack.rb b/Formula/ack.rb index abc1234..def5678 100644 --- a/Formula/ack.rb +++ b/Formula/ack.rb @@ -5,4 +5,8 @@ @url="http://ack.googlecode.com/svn/tags/#{@version}/ack" @md5='8009a13ab0fc66047bea0ea2ad89419c' @homepage='http://betterthangrep.com/' + + def download_strategy + HttpDownloadStrategy + end end
Support building from Subversion repositories Adds a new DownloadStrategy that checks files out from Subversion to the cache, then exports over to the temp folder for the build. To use checkout with the svn:// protocol or reimplement download_strategy and return SubversionDownloadStrategy.
diff --git a/app/controllers/destinations_import_model.rb b/app/controllers/destinations_import_model.rb index abc1234..def5678 100644 --- a/app/controllers/destinations_import_model.rb +++ b/app/controllers/destinations_import_model.rb @@ -24,6 +24,10 @@ attr_accessor :replace, :file validates :file, presence: true + def replace=(value) + @replace = ActiveRecord::ConnectionAdapters::Column.value_to_boolean(value) + end + def tempfile file.tempfile end
Fix 'replace' mode on import
diff --git a/app/helpers/cross_domain_analytics_helper.rb b/app/helpers/cross_domain_analytics_helper.rb index abc1234..def5678 100644 --- a/app/helpers/cross_domain_analytics_helper.rb +++ b/app/helpers/cross_domain_analytics_helper.rb @@ -3,7 +3,7 @@ { 'register-to-vote' => 'UA-23066786-5', 'accelerated-possession-eviction' => 'UA-37377084-12', - 'renewtaxcredits' => 'UA-43414424-1', # HMRC, https://www.pivotaltracker.com/n/projects/1261204 + 'renewtaxcredits' => 'UA-43414424-1', }[slug] end end
Remove link to pivotal story
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -48,4 +48,9 @@ print.output end + get '/' do + content_type 'text/html' + erb :lanes_root_view + end + end
Add route to mount view
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -16,7 +16,7 @@ # Admin routes namespace :products, :path => '' do namespace :admin, :path => Refinery::Core.backend_route do - scope :path => Refinery::Products.products_path do + scope :path => Refinery::Products.shop_path do root :to => "products#index" resources :products, :except => :show do
Change admin scope path for /shop
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,8 @@ require 'sidekiq/web' require 'sidekiq-scheduler/web' + +Sidekiq::Web.instance_variable_get(:@middleware).delete_if { |klass,_,_| klass == Rack::Protection } +Sidekiq::Web.set :protection, except: :content_security_policy Rails.application.routes.draw do mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
Allow sidekiq web assets to load under rack-protection
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,7 @@ ActionController::Routing::Routes.draw do |map| - map.open_window 'window_rails/open_window', :controller => :window_rails, :action => :open_window + if(Rails.version.split('.').first.to_i < 3) + map.open_window 'window_rails/open_window', :controller => :window_rails, :action => :open_window + else + match 'window_rails/open_window' => 'window_rails#open_window' + end end
Update routing for rails 3
diff --git a/spec/dockly/tar_diff_spec.rb b/spec/dockly/tar_diff_spec.rb index abc1234..def5678 100644 --- a/spec/dockly/tar_diff_spec.rb +++ b/spec/dockly/tar_diff_spec.rb @@ -0,0 +1,85 @@+require 'spec_helper' + +describe Dockly::TarDiff do + let(:base) { StringIO.new } + let(:input) { StringIO.new } + let(:output) { StringIO.new } + subject { described_class.new(base, input, output) } + + describe "#quick_write" do + let(:input) { StringIO.new(message) } + + context "for a message under 4096 bytes" do + let(:message) { "\0" * 100 } + + it "reads and writes only once" do + input.should_receive(:read).once.and_call_original + subject.quick_write(message.size) + end + end + + context "for a message over 4096 bytes" do + let(:message) { "\0" * 4097 } + + it "reads and writes only once" do + input.should_receive(:read).twice.and_call_original + subject.quick_write(message.size) + end + end + end + + describe "#write_tar_section" do + let(:header) { "ab" } + let(:message) { "cd" } + let(:input) { StringIO.new(message) } + let(:size) { message.size } + let(:remainder) { 3 } + let(:output_message) { "abcd\0\0\0" } + + it "it writes the header, size length message and remainder to the output" do + subject.write_tar_section(header, size, remainder) + expect(output.string).to be == output_message + end + end + + describe "#read_header" do + let(:input) { File.open("spec/fixtures/test-3.tar") } + + it "with a tar with 2 files should yield exactly four times; 2 files + 2 512 byte null blocks" do + expect do |b| + block = b.to_proc + subject.read_header(input) do |*args| + block.call(*args) + + data, name, prefix, mtime, size, remainder, empty = args + + case b.num_yields + when 1 + expect(name).to be == "Rakefile" + when 2 + expect(name).to be == "Procfile" + when 3 + expect(empty).to be_true + when 4 + expect(empty).to be_true + else + raise "Failed" + end + + input.read(size) + end + end.to yield_control.exactly(4).times + end + end + + describe "#process" do + let(:base) { File.open('spec/fixtures/test-1.tar') } + let(:input) { File.open('spec/fixtures/test-3.tar') } + + it "only adds the new file to the output" do + subject.process + expect(output.string).to include("Procfile") + expect(output.string).to_not include("Rakefile") + end + end +end
Add spec for tar diff
diff --git a/schema.gemspec b/schema.gemspec index abc1234..def5678 100644 --- a/schema.gemspec +++ b/schema.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'evt-schema' s.summary = "Primitives for schema and data structure" - s.version = '2.2.4.0' + s.version = '2.2.4.1' s.description = ' ' s.authors = ['The Eventide Project']
Package version is increased from 2.2.4.0 to 2.2.4.1
diff --git a/app/models/hackbot/interactions/help.rb b/app/models/hackbot/interactions/help.rb index abc1234..def5678 100644 --- a/app/models/hackbot/interactions/help.rb +++ b/app/models/hackbot/interactions/help.rb @@ -1,10 +1,7 @@ module Hackbot module Interactions - class Help < Hackbot::Interactions::Channel - def self.should_start?(event, team) - event[:type].eql?('message') && - mentions_command?(event, team, 'help') - end + class Help < Command + TRIGGER = /help/ def start(_event) msg_channel copy('help')
Convert Hackbot::Interactions::Help to a Command
diff --git a/spec/language/string_spec.rb b/spec/language/string_spec.rb index abc1234..def5678 100644 --- a/spec/language/string_spec.rb +++ b/spec/language/string_spec.rb @@ -0,0 +1,15 @@+# -*- encoding: us-ascii -*- +# +with_feature :encoding do + describe "Ruby String interpolation" do + it "creates a String when a string doesn't have an encoding yet" do + a = "ascii" + b = "\x00+/\xa8" + b.instance_variable_set("@encoding", nil) + + str = "#{a}:#{b}" + str.should == "ascii:\x00+/\xa8" + str.encoding.should == Encoding::ASCII_8BIT + end + end +end
Add Rubinius specific spec for string building This ensures that we cover the behavior of string interpolation where the string doesn't have an encoding yet. This is possible on Rubinius, we only setup the encoding then in the method retrieving the encoding from the string. This is an extraction from issue #2222 and is added to prevent regressions in this behavior.
diff --git a/spec/network/network_spec.rb b/spec/network/network_spec.rb index abc1234..def5678 100644 --- a/spec/network/network_spec.rb +++ b/spec/network/network_spec.rb @@ -1,6 +1,7 @@ require_relative '../tests/netbase/netbase_spec.rb' require_relative '../tests/dhcp/dhcp_spec.rb' -require_relative '../tests/l3/l3_spec.rb' +# NOTE(EmilienM) Github issue #43 +# require_relative '../tests/l3/l3_spec.rb' require_relative '../tests/lbaas/lbaas_spec.rb' require_relative '../tests/metadata/metadata_spec.rb' require_relative '../tests/networkcontroller/networkcontroller_spec.rb'
Disable L3 tests on network Bug #43 Signed-off-by: Emilien Macchi <d605a501dec15c980af71d9dfebf4b595ab6da1f@enovance.com>
diff --git a/has_configuration.gemspec b/has_configuration.gemspec index abc1234..def5678 100644 --- a/has_configuration.gemspec +++ b/has_configuration.gemspec @@ -30,6 +30,6 @@ spec.add_development_dependency('coveralls') spec.add_development_dependency('rake') spec.add_development_dependency('rspec') - spec.add_development_dependency('rubocop', '< 0.75') + spec.add_development_dependency('rubocop') spec.add_development_dependency('rubocop-rspec') end
Remove version pin from Rubocop because Ruby 2.2 is not supported anymore
diff --git a/db/schema.rb b/db/schema.rb index abc1234..def5678 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -0,0 +1,38 @@+# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20140130193522) do + + create_table "activities", force: true do |t| + t.string "name" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "schedules", force: true do |t| + t.date "date" + t.time "time_start" + t.time "time_end" + t.integer "quantity" + t.integer "amount_sold" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "vendors", force: true do |t| + t.string "name" + t.datetime "created_at" + t.datetime "updated_at" + end + +end
Migrate vendor, activities, and schedules
diff --git a/app/validators/shape_validator.rb b/app/validators/shape_validator.rb index abc1234..def5678 100644 --- a/app/validators/shape_validator.rb +++ b/app/validators/shape_validator.rb @@ -13,10 +13,14 @@ # @param [Charta::Geometry] shape # @return [Boolean] def valid?(shape) - res = ActiveRecord::Base.connection.execute <<~SQL + pg_res = ActiveRecord::Base.connection.execute <<~SQL SELECT ST_IsValid(ST_GeomFromEWKT('#{shape.to_ewkt}')) AS v SQL - res.to_a.first['v'] == 't' + # With AR 4.2 't' was returned + # With AR 5.0, we have true + res = pg_res.to_a.first['v'] + + res.is_a?(TrueClass) || res == 't' end end
Make ShapeValidator Rails 5.0 compatible
diff --git a/spree_static_content.gemspec b/spree_static_content.gemspec index abc1234..def5678 100644 --- a/spree_static_content.gemspec +++ b/spree_static_content.gemspec @@ -15,7 +15,7 @@ s.require_path = 'lib' s.requirements << 'none' - s.add_dependency 'spree_core', '~> 1.3.0' + s.add_dependency 'spree_core', '~> 1.3.0.rc1' s.add_development_dependency 'capybara', '1.0.1' s.add_development_dependency 'factory_girl', '~> 2.6'
Update spree version to 1.3.0.rc1
diff --git a/app/controllers/api/items_controller.rb b/app/controllers/api/items_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/items_controller.rb +++ b/app/controllers/api/items_controller.rb @@ -1,15 +1,10 @@ class Api::ItemsController < ApiController def index item_type_id = params[:item_type_id] + @items = Item.all.order(change_query_order) - @items = if @@query.empty? && item_type_id == nil - Item.all.order(change_query_order) - elsif @@query.empty? == false - Item.where("lower(title) LIKE ? OR - lower(origin_type) = ?", @@query, @@query.gsub("%", "")).order(change_query_order) - else - Item.where("item_type_id = ?", item_type_id).order(change_query_order) - end + @items = @items.where("item_type_id = ?", item_type_id).order(change_query_order) if item_type_id.present? + @items = Item.where("lower(title) LIKE ? OR lower(origin_type) = ?", @@query, @@query.gsub("%", "")).order(change_query_order) unless @@query.empty? paginate json: @items, per_page: change_per_page end
Change API Item Query To Use Multiple Criteria
diff --git a/app/controllers/trackings_controller.rb b/app/controllers/trackings_controller.rb index abc1234..def5678 100644 --- a/app/controllers/trackings_controller.rb +++ b/app/controllers/trackings_controller.rb @@ -12,25 +12,42 @@ # GET /trackings/1 # GET /trackings/1.json def show - @tracking = Tracking.find(params[:id]) + tracking = Tracking.find_by_id(params[:id]) - render json: @tracking + return render json: {}, status: 404 unless tracking + return render json: {}, status: 403 if tracking.user != current_user + + render json: tracking , status: 200 end # POST /trackings # POST /trackings.json def create + tracking_params = params.require(:tracking).permit(:start, :stop, :description) + + tracking = Tracking.create(tracking_params) + tracking.user = current_user + if tracking.save + render json: { id: tracking.id }, status: 201 + else + render json: {}, status: 400 + end end # PATCH/PUT /trackings/1 # PATCH/PUT /trackings/1.json def update - @tracking = Tracking.find(params[:id]) + tracking_params = params.require(:tracking).permit(:start, :stop, :description) - if @tracking.update(params[:tracking]) + tracking = Tracking.find_by_id(params[:id]) + return render json: {}, status: 404 unless tracking + + return render json: {}, status: 403 if tracking.user != current_user + + if tracking.update(tracking_params[:tracking]) head :no_content else - render json: @tracking.errors, status: :unprocessable_entity + render json: tracking.errors, status: 422 # Unprocessable Entity end end
Add show, create and update functionality for the Tracking controller
diff --git a/schema.gemspec b/schema.gemspec index abc1234..def5678 100644 --- a/schema.gemspec +++ b/schema.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'evt-schema' s.summary = "Primitives for schema and data structure" - s.version = '2.3.1.3' + s.version = '2.3.1.4' s.description = ' ' s.authors = ['The Eventide Project']
Package version is increased from 2.3.1.3 to 2.3.1.4
diff --git a/app/presenters/interaction_presenter.rb b/app/presenters/interaction_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/interaction_presenter.rb +++ b/app/presenters/interaction_presenter.rb @@ -19,7 +19,9 @@ { id: interaction.id, gene_name: interaction.gene.name, + entrez_id: interaction.gene.entrez_id, drug_name: interaction.drug.name, + chembl_id: interaction.drug.chembl_id, publications: interaction.publications.map(&:pmid), interaction_types: interaction.interaction_types.map(&:type), sources: interaction.sources.map(&:source_db_name),
Add chembl_id and entrez_id to interaction API endpoint
diff --git a/fizzbuzz/fizzbuzz.rb b/fizzbuzz/fizzbuzz.rb index abc1234..def5678 100644 --- a/fizzbuzz/fizzbuzz.rb +++ b/fizzbuzz/fizzbuzz.rb @@ -1,11 +1,14 @@ module FizzBuzz def self.play + + fizz = "Fizz" + buzz = "Buzz" played_array = (1..100).map do |i| played_i = "" - played_i = "Fizz" if divisible_by_3?(i) - played_i += "Buzz" if divisible_by_5?(i) + played_i = fizz if divisible_by_3?(i) + played_i += buzz if divisible_by_5?(i) played_i = i if played_i.length == 0 played_i end
Put 'Fizz' and 'Buzz' strings into ever so slightly more readable variables
diff --git a/app/services/email_retrieval_service.rb b/app/services/email_retrieval_service.rb index abc1234..def5678 100644 --- a/app/services/email_retrieval_service.rb +++ b/app/services/email_retrieval_service.rb @@ -5,13 +5,13 @@ end def retrieve_emails(partner) - @emails = @gmail.inbox.emails(from: partner.email).last(10) - save_emails(partner) - @email_count = @emails.count + emails = @gmail.inbox.emails(from: partner.email).last(10) + save_emails(partner, emails) + emails end - def save_emails(partner) - @emails.each do |email| + def save_emails(partner, emails) + emails.each do |email| new_email = Email.new(user_id: @user.id, partner_id: partner.id) new_email.update(subject: email.subject, text: clean_email_text(email), sent_at: email.date) end @@ -19,14 +19,19 @@ def clean_email_text(email) text = ActionView::Base.full_sanitizer.sanitize(email.body.decoded) - cleaned_headers = remove_headings(text) + shortened_text = shorten_text(text) + cleaned_headers = remove_headings(shortened_text) cleaned_spaces = remove_spaces(cleaned_headers) cleaned_text = remove_numbers(cleaned_spaces) return RbLibText.tokens(cleaned_text).join(" ") end + def shorten_text(text) + text.truncate(200000) + end + def remove_headings(text) - text.gsub(/.*Content-Transfer-Encoding/,'').gsub(/.*Content-Type.*[uUtTfF]-8/,'') + text.gsub(/.*Content-Transfer-Encoding/,'').gsub(/.*Content-Type.*[uUtTfF]-8/,'').gsub(/ application\/pdf.*/,'').gsub(/Content-Disposition.*/,'') end def remove_spaces(text)
Add many ways to clean up email text
diff --git a/seeder.gemspec b/seeder.gemspec index abc1234..def5678 100644 --- a/seeder.gemspec +++ b/seeder.gemspec @@ -18,5 +18,6 @@ s.add_dependency('activerecord', '>= 3.2', '< 5.0') s.add_development_dependency('mysql2', '~> 0.3.10') - s.add_development_dependency('rspec-rails', '~> 3.0') + s.add_development_dependency('rspec', '~> 3.0') + s.add_development_dependency('rake', '>= 10.4') end
Switch from rspec-rails to rspec This commit drops the development dependency on `rspec-rails`. The specs for `seeder` don't use any of the extra functionality beyond what is provided by `rspec`.
diff --git a/core/regexp/case_compare_spec.rb b/core/regexp/case_compare_spec.rb index abc1234..def5678 100644 --- a/core/regexp/case_compare_spec.rb +++ b/core/regexp/case_compare_spec.rb @@ -16,4 +16,10 @@ it "returns false if it does not match a Symbol" do (/a/ === :b).should be_false end + + # mirroring https://github.com/ruby/ruby/blob/trunk/test/ruby/test_regexp.rb + it "returns false if the other value cannot be coerced to a string" do + (/abc/ === nil).should be_false + (/abc/ === /abc/).should be_false + end end
Cover another regexp case that was failing in Opal
diff --git a/lib/sockjs/adapter.rb b/lib/sockjs/adapter.rb index abc1234..def5678 100644 --- a/lib/sockjs/adapter.rb +++ b/lib/sockjs/adapter.rb @@ -17,7 +17,7 @@ end def self.inherited(subclass) - @subclasses << subclass + Adapter.subclasses << subclass subclass.filters = Array.new end end
Add all subclasses to SockJS::Adapter.subclasses, not to ASubclass.subclasses.
diff --git a/bat/spec/spec_helper.rb b/bat/spec/spec_helper.rb index abc1234..def5678 100644 --- a/bat/spec/spec_helper.rb +++ b/bat/spec/spec_helper.rb @@ -5,7 +5,7 @@ SPEC_ROOT = File.expand_path(File.dirname(__FILE__)) RSpec.configure do |config| - unless ENV['BOSH_OS_BATS'] + unless ENV['BOSH_OS_BATS'] =~ (/^(true|yes|y|1)$/i) puts "!!! EXCLUDING SYSTEM SERVICE SPECS !!!" config.filter_run_excluding :type => :os end
Allow to implicitly disable OS bats by setting BOSH_OS_BATS to false Signed-off-by: Edward Zhang <acecdb50c47454737d0b9a0b29c19169fafbd4f7@cn.ibm.com>
diff --git a/lib/facter/gonzo.rb b/lib/facter/gonzo.rb index abc1234..def5678 100644 --- a/lib/facter/gonzo.rb +++ b/lib/facter/gonzo.rb @@ -26,4 +26,13 @@ open(input) { |f| f.each_line.detect { |line| /^release=.+$/i.match(line) } }.match(/\w+=(.+)/)[1] end end +end + +Facter.add(:gonzo_available_releases) do + setcode do + environment_dir = "/etc/puppetlabs/puppet/environments" + if Dir.exist? environment_dir + Pathname.glob("#{environment_dir}/*/").sort.map { |i| i.basename.to_s } + end + end end
Add fact to list available releases on master
diff --git a/lib/tasks/ladder.thor b/lib/tasks/ladder.thor index abc1234..def5678 100644 --- a/lib/tasks/ladder.thor +++ b/lib/tasks/ladder.thor @@ -0,0 +1,32 @@+# require defined gems +Bundler.require(:default) + +class Ladder < Thor + + desc "destroy URL", "Delete and (re)initialize a Ladder instance" + def destroy(url) + puts RestClient.delete compose_url(url) + end + + private + + # ensure that a string matches proper HTTP/HTTPS syntax + def validate_url(string) + schemes = ['http', 'https'] + match = string.match(URI.regexp(schemes)) + return (0 == match.begin(0) and string.size == match.end(0)) if match + false + end + + # format a URL for POSTing + def compose_url(url) + abort "Invalid URL: #{url}" unless validate_url(url) + + query = {} + + uri = URI(url) + uri.path = '/' + uri.to_s + end + +end
Add command to delete/init a Ladder instance
diff --git a/lib/koala/config.rb b/lib/koala/config.rb index abc1234..def5678 100644 --- a/lib/koala/config.rb +++ b/lib/koala/config.rb @@ -20,11 +20,12 @@ end def method_missing(method, *args) - case method - when /(.+)=$/ - self[$1] = args.pop - else - self[method.to_s] + match = method.to_s.match(/(.+)(=)$/) + + if match && match[2] + self[match[1]] = args.pop + else + self[method.to_s] end end end
Add support for ruby 1.8 with 'old' style matching.
diff --git a/lib/org-converge.rb b/lib/org-converge.rb index abc1234..def5678 100644 --- a/lib/org-converge.rb +++ b/lib/org-converge.rb @@ -24,21 +24,3 @@ end end end - -module StringWithColors - def red; colorize("\e[0m\e[31m"); end - def green; colorize("\e[0m\e[32m"); end - def yellow; colorize("\e[0m\e[33m"); end - def blue; colorize("\e[0m\e[34m"); end - def magenta; colorize("\e[0m\e[35m"); end - def cyan; colorize("\e[0m\e[36m"); end - def white; colorize("\e[0m\e[37m"); end - def bright_black; colorize("\e[0m\e[30m"); end - def bright_magenta; colorize("\e[0m\e[35m"); end - def bold; colorize("\e[0m\e[1m"); end - def colorize(color_code); "#{color_code}#{self}\e[0m"; end -end - -class String - include StringWithColors -end
Remove old coloring code since we use tco gem now
diff --git a/lib/tasks/data.rake b/lib/tasks/data.rake index abc1234..def5678 100644 --- a/lib/tasks/data.rake +++ b/lib/tasks/data.rake @@ -1,5 +1,27 @@ namespace :data do namespace :migrate do + desc "migrate deprecated problems" + task :deprecated_problems do + require 'bundler' + Bundler.require + require_relative '../exercism' + # in Ruby + { + 'point-mutations' => 'hamming' + }.each do |deprecated, replacement| + UserExercise.where(language: 'ruby', slug: deprecated).each do |exercise| + unless UserExercise.where(language: 'ruby', slug: replacement, user_id: exercise.user_id).count > 0 + exercise.slug = replacement + exercise.save + exercise.submissions.each do |submission| + submission.slug = replacement + submission.save + end + end + end + end + end + desc "migrate nitpicker status" task :nitpicker_status do require 'bundler'
Add task to migrate deprecated ruby exercise
diff --git a/clipp/tests/tc_regression.rb b/clipp/tests/tc_regression.rb index abc1234..def5678 100644 --- a/clipp/tests/tc_regression.rb +++ b/clipp/tests/tc_regression.rb @@ -26,7 +26,7 @@ clipp( input: "echo:\"GET /foo\"", default_site_config: <<-EOS - Rule REQUEST_METHOD "@rx GET" id:1 phase:REQUEST_HEADER block event + Rule REQUEST_METHOD @rx GET id:1 phase:REQUEST_HEADER block event EOS ) assert_log_match /action "block" executed/
clipp: Fix one test to use new rule syntax.
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index abc1234..def5678 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -2,4 +2,4 @@ # Specify a serializer for the signed and encrypted cookie jars. # Valid options are :json, :marshal, and :hybrid. -Rails.application.config.action_dispatch.cookies_serializer = :hybrid +Rails.application.config.action_dispatch.cookies_serializer = :json
Switch to the :json cookie serializer This application doesn't use cookies from Rails as far as I'm aware, so switch the configuration to the :json serializer, as this avoids brakeman picking up security issues with the :marshal serializer.
diff --git a/db/migrate/20130804154805_setup_hstore.rb b/db/migrate/20130804154805_setup_hstore.rb index abc1234..def5678 100644 --- a/db/migrate/20130804154805_setup_hstore.rb +++ b/db/migrate/20130804154805_setup_hstore.rb @@ -1,9 +1,11 @@ class SetupHstore < ActiveRecord::Migration def self.up - execute "CREATE EXTENSION IF NOT EXISTS hstore" +# Production boxes don't have the rights to do this +# execute "CREATE EXTENSION IF NOT EXISTS hstore" end def self.down - execute "DROP EXTENSION IF EXISTS hstore" +# Production boxes don't have the rights to do this +# execute "DROP EXTENSION IF EXISTS hstore" end end
Remove hstore create - has to be manually run.
diff --git a/lib/idealista/property.rb b/lib/idealista/property.rb index abc1234..def5678 100644 --- a/lib/idealista/property.rb +++ b/lib/idealista/property.rb @@ -2,7 +2,7 @@ class Property # TODO all idealista attributes or only some? allow configure? # TODO Location class? - attr_reader :price, :address, :bedrooms, :bathrooms, :description, :distance, :floor, :latitude, :longitude + attr_reader :price, :address, :bedrooms, :bathrooms, :description, :distance, :floor, :latitude, :longitude, :url def initialize(attributes = {}) # add type argument @@ -16,6 +16,7 @@ @floor = attributes['floor'] @latitude = attributes['latitude'] @longitude = attributes['longitude'] + @url = attributes['url'] # TODO create instance vars and attr_accessors with options hash end
Add @url to Property class
diff --git a/lib/jsonlint/rake_task.rb b/lib/jsonlint/rake_task.rb index abc1234..def5678 100644 --- a/lib/jsonlint/rake_task.rb +++ b/lib/jsonlint/rake_task.rb @@ -34,12 +34,10 @@ files_to_check_raw = Rake::FileList.new(paths) files_to_exclude = Rake::FileList.new(exclude_paths) - files_to_check = files_to_check_raw - files_to_exclude + files_to_check = files_to_check_raw.exclude(files_to_exclude) puts "Checking #{files_to_check.flatten.length} files" puts "Excluding #{files_to_exclude.flatten.length} files" - - puts "Checking #{files_to_check.flatten.length} files" linter = ::JsonLint::Linter.new linter.check_all(files_to_check)
Use instead of and remove extra puts
diff --git a/spec/integration/snmpjr_walk_spec.rb b/spec/integration/snmpjr_walk_spec.rb index abc1234..def5678 100644 --- a/spec/integration/snmpjr_walk_spec.rb +++ b/spec/integration/snmpjr_walk_spec.rb @@ -11,14 +11,13 @@ it 'can perform a simple synchronous walk request on an snmp agent' do response = subject.walk '1.3.6.1.2.1.1' expect(response.count).to eq 11 - expect(response.first.value).to eq 'SunOS zeus.snmplabs.com 4.1.3_U1 1 sun4m' - expect(response.last.value).to eq 'Timeticks: (1) 0:00:00.01' + expect(response.first.to_s).to eq 'SunOS zeus.snmplabs.com 4.1.3_U1 1 sun4m' + expect(response.last.to_s).to match /^\d+\:\d+:\d+\.\d+$/ end - context "when an invalid oid is requested" do - - it 'returns an error' do - expect(subject.walk '1.3.6.1.5').to eq Snmpjr::Response.new(error: 'noSuchInstance') + context "when a non existent subtree is walked" do + it 'returns an empty array' do + expect(subject.walk '1.3.6.1.5').to eq [] end end end
Modify the integration spec to match the snmp4j behaviour
diff --git a/spec/models/rejection_reason_spec.rb b/spec/models/rejection_reason_spec.rb index abc1234..def5678 100644 --- a/spec/models/rejection_reason_spec.rb +++ b/spec/models/rejection_reason_spec.rb @@ -1,7 +1,6 @@-require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') +require 'rails_helper' describe RejectionReason do - describe "#options_for_select" do it "should load the reasons and codes from the rejection reasons file" do expect(RejectionReason.options_for_select.size).to eq(6)
Fix require of Rails spec helper There's no need to do a relative require as the load paths are setup correctly.
diff --git a/Formula/gdb.rb b/Formula/gdb.rb index abc1234..def5678 100644 --- a/Formula/gdb.rb +++ b/Formula/gdb.rb @@ -1,7 +1,7 @@ require 'formula' class Gdb < Formula - url 'http://ftp.gnu.org/gnu/gdb/gdb-7.3.1.tar.bz2' + url 'http://ftpmirror.gnu.org/gdb/gdb-7.3.1.tar.bz2' homepage 'http://www.gnu.org/software/gdb/' md5 'b89a5fac359c618dda97b88645ceab47'
Use ftpmirror.gnu.org for GNU urls Signed-off-by: Jack Nagel <43386ce32af96f5c56f2a88e458cb94cebee3751@gmail.com>
diff --git a/lib/mongoid/contextual.rb b/lib/mongoid/contextual.rb index abc1234..def5678 100644 --- a/lib/mongoid/contextual.rb +++ b/lib/mongoid/contextual.rb @@ -8,15 +8,15 @@ # The aggregate operations provided in the aggregate module get delegated # through to the context from the criteria. - delegate *Aggregable::Mongo.public_instance_methods(false), to: :context + delegate(*Aggregable::Mongo.public_instance_methods(false), to: :context) # The atomic operations provided in the atomic context get delegated # through to the context from the criteria. - delegate *Atomic.public_instance_methods(false), to: :context + delegate(*Atomic.public_instance_methods(false), to: :context) # The methods in the contexts themselves should all get delegated to, # including destructive, modification, and optional methods. - delegate *(Mongo.public_instance_methods(false) - [ :skip, :limit ]), to: :context + delegate(*(Mongo.public_instance_methods(false) - [ :skip, :limit ]), to: :context) # Get the context in which criteria queries should execute. This is either # in memory (for embedded documents) or mongo (for root level documents.)
Remove warning: `*' interpreted as argument prefix
diff --git a/lib/rmodbus/exceptions.rb b/lib/rmodbus/exceptions.rb index abc1234..def5678 100644 --- a/lib/rmodbus/exceptions.rb +++ b/lib/rmodbus/exceptions.rb @@ -15,7 +15,7 @@ module Errors - class ModBusException < Exception + class ModBusException < StandardError end class IllegalFunction < ModBusException
Add bugfix from release 0.2.2
diff --git a/lib/spree/adyen/engine.rb b/lib/spree/adyen/engine.rb index abc1234..def5678 100644 --- a/lib/spree/adyen/engine.rb +++ b/lib/spree/adyen/engine.rb @@ -18,6 +18,7 @@ initializer "spree.solidus-adyen.payment_methods", after: "spree.register.payment_methods" do |app| app.config.spree.payment_methods << Gateway::AdyenHPP + app.config.spree.payment_methods << Gateway::AdyenCreditCard end def self.activate
Make Adyen Credit Card payment method available
diff --git a/lib/standard_hierarchy.rb b/lib/standard_hierarchy.rb index abc1234..def5678 100644 --- a/lib/standard_hierarchy.rb +++ b/lib/standard_hierarchy.rb @@ -18,6 +18,10 @@ def self.find_ancestors(standards, standard, i) + # If it's a root standard, it doesn't have ancestors + if standard["depth"] == 0 + return [] + end last_standard = standard standards[i+1..-1].inject([]){ |acc, ss|
Fix problem with standards with depth 0 having ancestors
diff --git a/lib/weekly_commits/cli.rb b/lib/weekly_commits/cli.rb index abc1234..def5678 100644 --- a/lib/weekly_commits/cli.rb +++ b/lib/weekly_commits/cli.rb @@ -21,9 +21,13 @@ 5.times do |day_count| date = beg_week + day_count.days week_title = date.strftime('%a, %e %b %Y') - git_date_format = date.strftime('%y-%m-%e') + git_date_format = date.strftime('%Y-%m-%e') + + commits = `git --no-pager log --after='#{git_date_format} 00:00' --before='#{git_date_format} 23:59' --pretty=format:'%s'` + puts week_title.yellow - `git --no-pager log --after='#{git_date_format} 00:00' --before='#{git_date_format} 23:59' --pretty=format:'%s'` + puts commits + puts end end end
Use %Y for git date format
diff --git a/spec/integration/heartbeat_message_publishing_spec.rb b/spec/integration/heartbeat_message_publishing_spec.rb index abc1234..def5678 100644 --- a/spec/integration/heartbeat_message_publishing_spec.rb +++ b/spec/integration/heartbeat_message_publishing_spec.rb @@ -1,17 +1,8 @@ require "rails_helper" +require 'open3' describe "sending a heartbeat message on the queue", :type => :request do include MessageQueueHelpers - - before :all do - @old_publisher = Rails.application.queue_publisher - @config = YAML.load_file(Rails.root.join("config", "rabbitmq.yml"))[Rails.env].symbolize_keys - Rails.application.queue_publisher = QueuePublisher.new(@config) - end - - after :all do - Rails.application.queue_publisher = @old_publisher - end around :each do |example| @config = YAML.load_file(Rails.root.join("config", "rabbitmq.yml"))[Rails.env].symbolize_keys @@ -27,7 +18,8 @@ end it "should place a heartbeat message on the queue" do - Rails.application.queue_publisher.send_heartbeat + output, status = Open3.capture2e("bundle exec rake heartbeat_messages:send") + expect(status.exitstatus).to eq(0), "rake task errored. output: #{output}" delivery_info, properties, payload = wait_for_message_on(@queue) message = JSON.parse(payload)
Make heartbeat integration tests invoke rake task. To ensure they are a full end-to-end test
diff --git a/spec/support/shared_examples/multithreaded_adapter.rb b/spec/support/shared_examples/multithreaded_adapter.rb index abc1234..def5678 100644 --- a/spec/support/shared_examples/multithreaded_adapter.rb +++ b/spec/support/shared_examples/multithreaded_adapter.rb @@ -22,4 +22,21 @@ thread.join one.should_not == two end + + it "should allow multiple workers to complete jobs simultaneously" do + BlockJob.queue + worker_1 = Que::Worker.new + $q1.pop + + Que::Job.queue + DB[:que_jobs].count.should be 2 + + worker_2 = Que::Worker.new + sleep_until { worker_2.asleep? } + DB[:que_jobs].count.should be 1 + + $q2.push nil + sleep_until { worker_1.asleep? } + DB[:que_jobs].count.should be 0 + end end
Add an extra spec to make sure multiple Workers can run simultaneously on multithreaded adapters.
diff --git a/google_civic_info.gemspec b/google_civic_info.gemspec index abc1234..def5678 100644 --- a/google_civic_info.gemspec +++ b/google_civic_info.gemspec @@ -18,6 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.add_dependency "httparty" spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" end
Add explicit dependency on httparty
diff --git a/vendor/refinerycms/pages/spec/models/page_spec.rb b/vendor/refinerycms/pages/spec/models/page_spec.rb index abc1234..def5678 100644 --- a/vendor/refinerycms/pages/spec/models/page_spec.rb +++ b/vendor/refinerycms/pages/spec/models/page_spec.rb @@ -35,8 +35,12 @@ reset_page({:menu_match => '^/RSpec is great for testing too.*$'}) page_cannot_be_destroyed end + + it "will destroy if you really want it to! >:]" do + reset_page + @page.destroy! + end end - end
Make the destroy test a little more interesting
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -1,7 +1,9 @@ unless ENV['CI'] begin require 'simplecov' - SimpleCov.start + SimpleCov.start do + add_filter 'test' + end rescue LoadError end end
Exclude tests from code coverage report
diff --git a/light_show/combination.rb b/light_show/combination.rb index abc1234..def5678 100644 --- a/light_show/combination.rb +++ b/light_show/combination.rb @@ -14,36 +14,50 @@ @animations << animation end - # Iterate over the combined animations, lazily evaluating each frame. + # Frames for the combined animations, lazily evaluating each frame. # # If none or only one animation is provided, no combination is performed. # Iteration stops if any animation returns a nil frame. - def each_frame(previous, &block) - return if @animations.empty? - if @animations.size == 1 - # Pass-through, no combining needed - @animations.each_frame(previous, &block) - else - # Wrap each animation as a lazily-evaluated enumerator - enums = @animations.map do |animation| - Enumerator.new do |yielder| - animation.each_frame(previous) do |frame| - yielder << frame - end - end.lazy # lazy is critical! - end + def frames(previous) + return [] if @animations.empty? + return @animations.first.frames(previous) if @animations.size == 1 - # Then zip them together, combining each set of frames - enums.first.zip(*enums[1..-1]).each do |frames| - break if frames.any?(&:nil?) - block.call combine_frames(frames) + # Lazily zip the next frames of each animation together. Ruby 1.9.3 + # doesn't have lazy enumerators or lazy zip, so do it by hand. + Enumerator.new do |y| + enums = @animations.map { |anim| anim.frames(previous).each } + + loop do + begin + frames = enums.map(&:next) + y << combine_frames(frames) + rescue StopIteration + break + end end end end - # Combine a set of frames. Override this to define your own behavior. + # Combine a set of frames. + # + # Defaults to calling combine_colors with the colors for each pixel. + # + # Override this to define your own behavior. def combine_frames(frames) - raise NotImplementedError, "must implement combine_frames" + frames.first.zip(*frames[1..-1]).map do |pixels| + combine_pixels pixels + end + end + + # Combine pixels by calling combine_values on each of r, g, and b. + def combine_pixels(pixels) + pixels.first.zip(*pixels[1..-1]).map do |values| + combine_values values + end + end + + def combine_values(colors) + raise NotImplementedError, "must implement combine_values" end end end
Use the new enumerable approach for Combination
diff --git a/lib/clockwork/database_events/event.rb b/lib/clockwork/database_events/event.rb index abc1234..def5678 100644 --- a/lib/clockwork/database_events/event.rb +++ b/lib/clockwork/database_events/event.rb @@ -13,7 +13,7 @@ end def name - job.name + (job.respond_to?(:name) && job.name) ? job.name : "#{job.class}:#{job.id}" end def to_s @@ -26,7 +26,7 @@ protected def name_has_changed?(model) - name != model.name + !job.respond_to?(:name) || job.name != model.name end def frequency_has_changed?(model)
Make model name attribute optional * if model has no name attribute it will default to "[ModelClassName]:[id]
diff --git a/lib/scss_lint/linter/property_units.rb b/lib/scss_lint/linter/property_units.rb index abc1234..def5678 100644 --- a/lib/scss_lint/linter/property_units.rb +++ b/lib/scss_lint/linter/property_units.rb @@ -4,7 +4,6 @@ include LinterRegistry def visit_prop(node) - @node = node @global_allowed = config['global'].to_set @properties = config['properties'] @property = node.name.join @@ -12,26 +11,26 @@ return if @units.empty? - global_allows_ok? && property_allows_ok? + global_allows_ok?(node) && property_allows_ok?(node) end private - def global_allows_ok? + def global_allows_ok?(node) not_allowed = units_not_allowed_globally unless property_units_defined? unless not_allowed.empty? - add_lint(@node, "Units are not allowed globally: #{not_allowed.join(' ')}") + add_lint(node, "Units are not allowed globally: #{not_allowed.join(' ')}") end return false end true end - def property_allows_ok? + def property_allows_ok?(node) not_allowed = units_not_allowed_on_property unless not_allowed.empty? - add_lint(@node, "Units are not allowed on #{@property}: #{not_allowed.join(' ')}") + add_lint(node, "Units are not allowed on #{@property}: #{not_allowed.join(' ')}") return false end true
Remove unnecessary instance variable for node While not declaring the `node` as a parameter for these helpers can make things seem cleaner, it reduces the locality of the value's declaration to its use.
diff --git a/lib/stash_datacite/merritt_packager.rb b/lib/stash_datacite/merritt_packager.rb index abc1234..def5678 100644 --- a/lib/stash_datacite/merritt_packager.rb +++ b/lib/stash_datacite/merritt_packager.rb @@ -17,7 +17,7 @@ target_url = tenant.landing_url(path) folder = StashEngine::Resource.uploads_dir StashEngine::Sword::Package.new( - title: main_title(resource), + title: resource_title, doi: identifier, zipfile: resource_file_generation.generate_merritt_zip(folder, target_url), resource_id: resource.id, @@ -27,11 +27,11 @@ ) end - private - - def main_title(resource) - title = resource.titles.where(title_type: nil).first - title.try(:title) + def resource_title + @resource_title ||= begin + title = resource.titles.where(title_type: nil).first + title.try(:title) + end end end end
Add error/failure mail support to PackageJob
diff --git a/libimagruby/test/test_store_id_load.rb b/libimagruby/test/test_store_id_load.rb index abc1234..def5678 100644 --- a/libimagruby/test/test_store_id_load.rb +++ b/libimagruby/test/test_store_id_load.rb @@ -2,7 +2,7 @@ require 'fiddle' -lib = Fiddle::dlopen './target/debug/libimag_ruby.so' +lib = Fiddle::dlopen '../target/release/liblibimagruby.so' Fiddle::Function::new(lib['imag_ruby_initialize'], [], Fiddle::TYPE_VOIDP).call works = (not RStoreId.new_baseless("test").nil?)
Fix test script for new location of build articfact
diff --git a/graphql-batch.gemspec b/graphql-batch.gemspec index abc1234..def5678 100644 --- a/graphql-batch.gemspec +++ b/graphql-batch.gemspec @@ -7,7 +7,7 @@ spec.name = "graphql-batch" spec.version = GraphQL::Batch::VERSION spec.authors = ["Dylan Thacker-Smith"] - spec.email = ["Dylan.Smith@shopify.com"] + spec.email = ["gems@shopify.com"] spec.summary = "A query batching executor for the graphql gem" spec.homepage = "https://github.com/Shopify/graphql-batch"
Use gems@shopify.com email address in gemspec
diff --git a/test/controllers/backend/campaigns_controller_test.rb b/test/controllers/backend/campaigns_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/backend/campaigns_controller_test.rb +++ b/test/controllers/backend/campaigns_controller_test.rb @@ -2,6 +2,11 @@ module Backend class CampaignsControllerTest < ActionController::TestCase - test_restfully_all_actions + test_restfully_all_actions except: :open + + test 'open action in post mode' do + post :open, {:locale=>@locale, activity_id: activities(:activities_001).id, id: campaigns(:campaigns_001).id } + assert_redirected_to backend_campaign_path(campaigns(:campaigns_001)) + end end end
Fix campaign open action test