diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/webapp/db/migrate/20120322185636_return_new_not_null.rb b/webapp/db/migrate/20120322185636_return_new_not_null.rb index abc1234..def5678 100644 --- a/webapp/db/migrate/20120322185636_return_new_not_null.rb +++ b/webapp/db/migrate/20120322185636_return_new_not_null.rb @@ -0,0 +1,55 @@+class ReturnNewNotNull < ActiveRecord::Migration + def self.up + execute <<-SQL +CREATE OR REPLACE FUNCTION validate_participation() RETURNS trigger + LANGUAGE plpgsql + AS $$ +DECLARE + msg TEXT; +BEGIN + IF NEW.type = 'Jurisdiction' OR NEW.type = 'AssociatedJurisdiction' THEN + IF NEW.secondary_entity_id IS NULL THEN + RETURN NEW; + END IF; + PERFORM 1 + FROM places + JOIN places_types ON places_types.place_id = places.id + JOIN codes ON places_types.type_id = codes.id AND codes.the_code = 'J' + WHERE places.entity_id = NEW.secondary_entity_id; + msg := 'Participation types Jurisdiction and AssociatedJurisdiction must have a jurisdiction in their secondary_entity_id'; + ELSIF NEW.type IN ('Lab', 'ActualDeliveryFacility', 'ReportingAgency', 'DiagnosticFacility', 'ExpectedDeliveryFacility', 'InterestedPlace', 'HospitalizationFacility') THEN + IF NEW.secondary_entity_id IS NULL THEN + RETURN NEW; + END IF; + PERFORM 1 FROM places WHERE places.entity_id = NEW.secondary_entity_id; + msg := 'Participation types Lab, ActualDeliveryFacility, ReportingAgency, DiagnosticFacility, ExpectedDeliveryFacility, InterestedPlace, and HospitalizationFacility must have places in their secondary_entity_id'; + ELSIF NEW.type = 'InterestedParty' THEN + IF NEW.primary_entity_id IS NULL THEN + RETURN NEW; + END IF; + PERFORM 1 FROM people WHERE people.entity_id = NEW.primary_entity_id; + msg := 'InterestedParty participations must have a place in their primary_entity_id'; + ELSIF NEW.type = 'Clinician' OR NEW.type = 'HealthCareProvider' OR NEW.type = 'Reporter' THEN + IF NEW.secondary_entity_id IS NULL THEN + RETURN NEW; + END IF; + PERFORM 1 FROM people WHERE people.entity_id = NEW.secondary_entity_id; + msg := 'Participation types Clinician, HealthCareProvider, and Reporter must have people in their secondary_entity_ids'; + ELSE + IF NEW.secondary_entity_id IS NULL THEN + RETURN NEW; + END IF; + RAISE EXCEPTION 'Participation is invalid -- unknown type %', NEW.type; + END IF; + IF NOT FOUND THEN + RAISE EXCEPTION 'Validation error on participation %: %', NEW.id, msg; + END IF; + RETURN NEW; +END; +$$; + SQL + end + + def self.down + end +end
Fix return value from trigger when entity ids are null
diff --git a/app/decorators/gobierto_participation/process_term_decorator.rb b/app/decorators/gobierto_participation/process_term_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/gobierto_participation/process_term_decorator.rb +++ b/app/decorators/gobierto_participation/process_term_decorator.rb @@ -0,0 +1,67 @@+# frozen_string_literal: true + +module GobiertoParticipation + class ProcessTermDecorator < BaseDecorator + def initialize(term) + @object = term + end + + def active_pages + GobiertoCms::Page.pages_in_collections_and_container(site, object).sorted.active + end + + def site + @site ||= object.vocabulary.site + end + + def number_contributions + contributions.size + end + + def number_contributing_neighbours + contributions.pluck(:user_id).uniq.size + end + + def contributions + return GobiertoParticipation::Contribution.none unless association_with_processes + terms_key = GobiertoParticipation::Process.reflections[association_with_processes.to_s].foreign_key + processes_table = GobiertoParticipation::Process.table_name + containers_table = GobiertoParticipation::ContributionContainer.table_name + + GobiertoParticipation::Contribution.joins(contribution_container: :process) + .where("#{ containers_table }.visibility_level = ?", 1) + .where("#{ processes_table }.#{terms_key} = ?", id) + end + + def events + collection_items_table = ::GobiertoCommon::CollectionItem.table_name + item_type = ::GobiertoCalendars::Event + site.events.distinct.joins("INNER JOIN #{collection_items_table} ON \ + #{collection_items_table}.item_id = #{item_type.table_name}.id AND \ + #{collection_items_table}.item_type = '#{item_type}' AND \ + container_type = '#{object.class.name}' AND \ + container_id = #{object.id}\ + ") + end + + def processes + return GobiertoParticipation::Process.none unless association_with_processes + GobiertoParticipation::Process.where(association_with_processes => object) + end + + protected + + def association_with_processes + @association_with_processes ||= begin + return unless participation_settings.present? + GobiertoParticipation::Process.vocabularies.find do |_, setting| + participation_settings.send(setting).to_i == object.vocabulary_id.to_i + end&.first + end + end + + def participation_settings + @participation_settings ||= site.gobierto_participation_settings + end + end +end
Move issues extra functionality to a decorator
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -12,6 +12,7 @@ module RecordOfGuidance class Application < Rails::Application + config.action_mailer.default_url_options = { host: ENV['APPLICATION_HOST'] } config.active_job.queue_adapter = :sidekiq config.active_record.raise_in_transactional_callbacks = true end
Set action mailer default URL options
diff --git a/lib/scss_lint/reporter/xml_reporter.rb b/lib/scss_lint/reporter/xml_reporter.rb index abc1234..def5678 100644 --- a/lib/scss_lint/reporter/xml_reporter.rb +++ b/lib/scss_lint/reporter/xml_reporter.rb @@ -9,7 +9,8 @@ output << "<file name=#{filename.encode(xml: :attr)}>" file_lints.each do |lint| - output << "<issue line=\"#{lint.location.line}\" " \ + output << "<issue linter=\"#{lint.linter.name if lint.linter}\" " \ + "line=\"#{lint.location.line}\" " \ "column=\"#{lint.location.column}\" " \ "length=\"#{lint.location.length}\" " \ "severity=\"#{lint.severity}\" " \
Include linter name in XMLReporter Change-Id: I0c3ba513dbbd277fa1a1204b2257e7c20ff20d13 Reviewed-on: http://gerrit.causes.com/40810 Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com> Reviewed-by: Shane da Silva <67fb7bfe39f841b16a1f86d3928acc568d12c716@brigade.com>
diff --git a/lib/transforms.rb b/lib/transforms.rb index abc1234..def5678 100644 --- a/lib/transforms.rb +++ b/lib/transforms.rb @@ -1,10 +1,15 @@+# coding: utf-8 class String # Returns a-string-with-dashes when passed 'a string with dashes'. # All special chars are stripped in the process def to_url return if self.nil? - self.downcase.tr("\"'", '').gsub(/\W/, ' ').strip.tr_s(' ', '-').tr(' ', '-').sub(/^$/, "-") + s = self.downcase.tr("\"'", '') + # Inject correct version-dependent regex using string interpolations + # since the 1.9 version is invalid for 1.8. + s = s.gsub(/#{RUBY_VERSION < "1.9" ? '\W' : '\P{Word}'}/, ' ') + s.strip.tr_s(' ', '-').tr(' ', '-').sub(/^$/, "-") end # A quick and dirty fix to add 'nofollow' to any urls in a string.
Use version-specific regex in String.to_url. Since the meaning of \W changed, it needs to be replace with \P{Word} for Ruby 1.9. Unfortunately, this cannot be used in 1.8, since it's invalid there. The regexes are injected using string interpolation to avoid warnings in 1.8.
diff --git a/core/db/migrate/20130815024413_add_adjustment_total_to_shipments.rb b/core/db/migrate/20130815024413_add_adjustment_total_to_shipments.rb index abc1234..def5678 100644 --- a/core/db/migrate/20130815024413_add_adjustment_total_to_shipments.rb +++ b/core/db/migrate/20130815024413_add_adjustment_total_to_shipments.rb @@ -0,0 +1,5 @@+class AddAdjustmentTotalToShipments < ActiveRecord::Migration + def change + add_column :spree_shipments, :adjustment_total, :decimal, :precision => 10, :scale => 2, :default => 0.0 + end +end
Add missing adjustment_total column to shipments
diff --git a/db/migrate/20160714104844_change_mercado_pago_id_type_in_sources.rb b/db/migrate/20160714104844_change_mercado_pago_id_type_in_sources.rb index abc1234..def5678 100644 --- a/db/migrate/20160714104844_change_mercado_pago_id_type_in_sources.rb +++ b/db/migrate/20160714104844_change_mercado_pago_id_type_in_sources.rb @@ -0,0 +1,6 @@+class ChangeMercadoPagoIdTypeInSources < ActiveRecord::Migration + def change + change_column :mercado_pago_manual_sources, :mercado_pago_id, :bigint, limit: 8 + change_column :spree_mercado_pago_custom_sources, :mercado_pago_id, :bigint, limit: 8 + end +end
Increase limit in mercado_pago_id fields
diff --git a/hocon.gemspec b/hocon.gemspec index abc1234..def5678 100644 --- a/hocon.gemspec +++ b/hocon.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.name = 'hocon' - s.version = '0.0.5' - s.date = '2014-10-01' + s.version = '0.0.6' + s.date = '2014-10-14' s.summary = "HOCON Config Library" s.description = "== A port of the Java {Typesafe Config}[https://github.com/typesafehub/config] library to Ruby" s.authors = ["Chris Price", "Wayne Warren", "Dai Akatsuka", "Preben Ingvaldsen"]
Update gemspec for 0.0.6 release
diff --git a/ASMAsyncEnumeration.podspec b/ASMAsyncEnumeration.podspec index abc1234..def5678 100644 --- a/ASMAsyncEnumeration.podspec +++ b/ASMAsyncEnumeration.podspec @@ -10,6 +10,7 @@ s.ios.deployment_target = "7.0" s.osx.deployment_target = "10.9" + s.tvos.deployment_target = "9.0" s.requires_arc = true
Add tvos support to the podspec
diff --git a/lib/capistrano/tasks/dependencies.rake b/lib/capistrano/tasks/dependencies.rake index abc1234..def5678 100644 --- a/lib/capistrano/tasks/dependencies.rake +++ b/lib/capistrano/tasks/dependencies.rake @@ -8,7 +8,7 @@ execute "sudo apt-get update" execute "sudo apt-get -y install python3.7 python3-pip" execute :pip3, "install ndexutil -r #{current_path}/misc_scripts/ndex_requirements.txt --no-cache-dir --no-deps" - execute :pip3, "install civicpy==1.0.0rc2" + execute :pip3, "install civicpy==1.0.0rc5" end end end
Upgrade civicpy to the latest version
diff --git a/lib/hotel_beds/hotel_search/request.rb b/lib/hotel_beds/hotel_search/request.rb index abc1234..def5678 100644 --- a/lib/hotel_beds/hotel_search/request.rb +++ b/lib/hotel_beds/hotel_search/request.rb @@ -17,7 +17,7 @@ attribute :rooms, Array[HotelBeds::Model::RequestedRoom] # validation - validates :destination_code, length: { is: 3, allow_blank: false } + validates :destination_code, length: { minimum: 2, maximum: 3, allow_blank: false } validates :session_id, :check_in_date, :check_out_date, presence: true validates :rooms, length: { minimum: 1, maximum: 5 } validates :page_number, numericality: {
Change the destination_code validation to min 2 and max 3.
diff --git a/lib/inline_svg/transform_pipeline/transformations/transformation.rb b/lib/inline_svg/transform_pipeline/transformations/transformation.rb index abc1234..def5678 100644 --- a/lib/inline_svg/transform_pipeline/transformations/transformation.rb +++ b/lib/inline_svg/transform_pipeline/transformations/transformation.rb @@ -12,6 +12,14 @@ def transform(*) raise "#transform should be implemented by subclasses of Transformation" + end + + # Parses a document and yields the contained SVG nodeset to the given block + # if it exists. + # + # Returns a Nokogiri::XML::Document. + def with_svg(doc) + doc = Nokogiri::XML::Document.parse(doc.to_html) end end
Return a parsed version of the provided document
diff --git a/ruby/homeworks.rb b/ruby/homeworks.rb index abc1234..def5678 100644 --- a/ruby/homeworks.rb +++ b/ruby/homeworks.rb @@ -0,0 +1,17 @@+# Day 2 +####### + +## Task 1 +## Print the content of an array of sixteen numbers, four numbers at a time, +## using just `each'. +arr = [] +(1..16).to_a.each do |n| + arr << n + if (n % 4).zero? + puts arr.join + arr = [] + end +end + +##Now, do the same with `each_slice' in 'Enumerable`. +(1..16).each_slice(4).each {|arr| puts arr.join}
Add the 2nd day self-study tasks
diff --git a/sandbox/task.rake b/sandbox/task.rake index abc1234..def5678 100644 --- a/sandbox/task.rake +++ b/sandbox/task.rake @@ -3,7 +3,7 @@ class SandboxTask < BaseTask def initialize(*args) super - self.sandboxdir = "sandbox/ruby-#{package.rubyver}" + self.sandboxdir = "sandbox/ruby-#{package.rubyver}-#{package.arch}" self.sandboxdirmgw = File.join(sandboxdir, package.mingwdir) self.sandboxdir_abs = File.expand_path(sandboxdir, package.rootdir) ruby_exe = "#{sandboxdirmgw}/bin/ruby.exe" @@ -14,7 +14,7 @@ file ruby_exe => compile_task.pkgfile do # pacman doesn't work on automount paths (/c/path), so that we # mount to /tmp - pmrootdir = "/tmp/rubyinstaller/ruby-#{package.rubyver}" + pmrootdir = "/tmp/rubyinstaller/ruby-#{package.rubyver}-#{package.arch}" mkdir_p File.join(ENV['RI_DEVKIT'], pmrootdir) mkdir_p sandboxdir rm_rf sandboxdir
Use per distinct sandbox directory per arch. This avoids repeated deletion of the sanbox folder.
diff --git a/lib/buildr/bnd/project_extension.rb b/lib/buildr/bnd/project_extension.rb index abc1234..def5678 100644 --- a/lib/buildr/bnd/project_extension.rb +++ b/lib/buildr/bnd/project_extension.rb @@ -1,59 +1,36 @@ module Buildr module Bnd - include Buildr::Extension + module ProjectExtension + include Extension - class << self - - # The specs for requirements - def requires - ["biz.aQute:bnd:jar:0.0.384"] + first_time do + desc "Does `bnd print` on the packaged bundle and stdouts the output for inspection" + Project.local_task("bnd:print") end - # Repositories containing the requirements - def remote_repositories - puts "Buildr::Bnd.remote_repositories is deprecated. Please use Buildr::Bnd.remote_repository instead." - [remote_repository] + def package_as_bundle(filename) + project.task('bnd:print' => [filename]) do |task| + Buildr::Bnd.bnd_main("print", filename) + end + + dirname = File.dirname(filename) + directory(dirname) + + # Add Buildr.application.buildfile so it will rebuild if we change settings + task = BundleTask.define_task(filename => [Buildr.application.buildfile, dirname]) + task.project = self + # the last task is the task considered the packaging task + task end - # Repositories containing the requirements - def remote_repository - "http://www.aQute.biz/repo" + def package_as_bundle_spec(spec) + # Change the source distribution to .jar extension + spec.merge(:type => :jar) end - - def bnd_main(*args) - cp = Buildr.artifacts(self.requires).each(&:invoke).map(&:to_s).join(File::PATH_SEPARATOR) - Java::Commands.java 'aQute.bnd.main.bnd', *(args + [{ :classpath => cp }]) - end - - end - - def package_as_bundle(filename) - project.task('bnd:print' => [filename]) do |task| - Bnd.bnd_main( "print", filename ) - end - - dirname = File.dirname(filename) - directory( dirname ) - - # Add Buildr.application.buildfile so it will rebuild if we change settings - task = BundleTask.define_task(filename => [Buildr.application.buildfile, dirname]) - task.project = self - # the last task is the task considered the packaging task - task - end - - def package_as_bundle_spec(spec) - # Change the source distribution to .jar extension - spec.merge( :type => :jar ) - end - - first_time do - desc "Does `bnd print` on the packaged bundle and stdouts the output for inspection" - Project.local_task("bnd:print") end end end class Buildr::Project - include Buildr::Bnd + include Buildr::Bnd::ProjectExtension end
Refactor extension so that it looks like the extension in other projects
diff --git a/test/cookbooks/application_ruby_test/recipes/rails.rb b/test/cookbooks/application_ruby_test/recipes/rails.rb index abc1234..def5678 100644 --- a/test/cookbooks/application_ruby_test/recipes/rails.rb +++ b/test/cookbooks/application_ruby_test/recipes/rails.rb @@ -18,7 +18,7 @@ package value_for_platform_family(debian: 'ruby-dev', rhel: 'ruby-devel') package value_for_platform_family(debian: 'zlib1g-dev', rhel: 'zlib-devel') -package value_for_platform_family(debian: 'libsqlite3-dev', rhel: 'sqlite3-devel') +package value_for_platform_family(debian: 'libsqlite3-dev', rhel: 'sqlite-devel') application '/opt/test_rails' do git 'https://github.com/poise/test_rails.git'
Fix package name for RHEL.
diff --git a/spec/ci/php70_spec.rb b/spec/ci/php70_spec.rb index abc1234..def5678 100644 --- a/spec/ci/php70_spec.rb +++ b/spec/ci/php70_spec.rb @@ -3,6 +3,23 @@ describe 'PHP 7.0 CI' do include_context 'ci' do let(:php_version) { '7.0' } + + let(:php_packages) { [ + 'apache2', + 'php7.0', + 'php7.0-cli', + 'mysql-client', + 'memcached', + 'php7.0-gd', + 'php7.0-dev', + 'php7.0-curl', + 'php7.0-mysql', + 'php-memcached', + 'php-soap', + 'php-pear' + ] } + + let(:apache_php_mod) { 'php7_module' } end before(:all) do
Set php_packages and apache_php_mod for CI php 7.0 spec.
diff --git a/example/config.ru b/example/config.ru index abc1234..def5678 100644 --- a/example/config.ru +++ b/example/config.ru @@ -24,7 +24,7 @@ use Rack::Session::Cookie use OmniAuth::Builder do - provider :stitchlabs, ENV['STITCHLABS_CLIENT_ID'], ENV['STITCHLABS_CLIENT_SECRET'] + provider :stitchlabs, ENV['STITCHLABS_CLIENT_ID'], ENV['STITCHLABS_CLIENT_SECRET'], client_options: { site: "https://api.slbmj2010.com" } end run App.new
Use staging for testing example app.
diff --git a/scripts/cli2md.rb b/scripts/cli2md.rb index abc1234..def5678 100644 --- a/scripts/cli2md.rb +++ b/scripts/cli2md.rb @@ -1,13 +1,16 @@ require 'cgi' incode = false + +first_param = false + ARGF.each_with_index do |line, line_num| - # Headings + # Headings if /^(\w*):/ =~ line puts "## #{$1}" # Initial usage command elsif line_num == 2 - puts "`#{line.strip}`" + puts "`#{line.strip}`" # Code sections elsif /\s{3}\$/ =~ line # Break code lines that end in \ @@ -22,14 +25,21 @@ # Lists of parameters # --config value Path to a configuration file [$BUILDKITE_AGENT_CONFIG] elsif /\s{3}(-{2}[a-z0-9\- ]*)([A-Z].*)$/ =~ line + if(first_param==false) + puts "<table>" + first_param = true + end command = $1.rstrip desc = $2 # Wrap $BUILDKITE_* env vars in code - desc.gsub!(/(\$BUILDKITE[A-Z0-9_]*)/,"`\\1`") + desc.gsub!(/(\$BUILDKITE[A-Z0-9_]*)/,"<code>\\1</code>") # Wrap https://agent.buildkite.com/v3 in code - desc.gsub!('https://agent.buildkite.com/v3',"`https://agent.buildkite.com/v3`") - puts "* `#{command}` - #{desc}" + desc.gsub!('https://agent.buildkite.com/v3',"<code>https://agent.buildkite.com/v3</code>") + puts "<tr><td><code>#{command}</code></td><td><p>#{desc}</p></td>" else + if(first_param==true) + puts "</table>" + end puts CGI::escapeHTML(line.lstrip) end end
Make a table instead of using a list
diff --git a/lib/active_support/cache/redis_content_store.rb b/lib/active_support/cache/redis_content_store.rb index abc1234..def5678 100644 --- a/lib/active_support/cache/redis_content_store.rb +++ b/lib/active_support/cache/redis_content_store.rb @@ -19,13 +19,13 @@ #---------- - def read_entry(key,options) + def read_entry(key,options={}) super(key,options) end #---------- - def write_entry(key,entry,options) + def write_entry(key,entry,options={}) # expire this key from existing sets @data.keys(SET_PREFIX+"*").each do |obj| @data.srem(obj,key)
Make options hashes for read_entry and write_entry optional
diff --git a/lib/metasploit_data_models/active_record_models/module_mixin.rb b/lib/metasploit_data_models/active_record_models/module_mixin.rb index abc1234..def5678 100644 --- a/lib/metasploit_data_models/active_record_models/module_mixin.rb +++ b/lib/metasploit_data_models/active_record_models/module_mixin.rb @@ -1,7 +1,7 @@ module MetasploitDataModels::ActiveRecordModels::ModuleMixin def self.included(base) base.class_eval{ - base.table_name = "module_mixin" + base.table_name = "module_mixins" belongs_to :module_detail validate :name, :presence => true }
Fix typo in table name
diff --git a/lib/prosys/payloads/create_order.rb b/lib/prosys/payloads/create_order.rb index abc1234..def5678 100644 --- a/lib/prosys/payloads/create_order.rb +++ b/lib/prosys/payloads/create_order.rb @@ -25,6 +25,9 @@ end end end + if @attributes[:testing] + doc.tag!("test","yes") + end end end end
Add testing tag if testing
diff --git a/Formula/strigi.rb b/Formula/strigi.rb index abc1234..def5678 100644 --- a/Formula/strigi.rb +++ b/Formula/strigi.rb @@ -6,13 +6,13 @@ @md5='324fd9606ac77765501717ff92c04f9a' depends_on 'cmake' - depends_on 'CLucene' + depends_on 'clucene' def install ENV['CLUCENE_HOME'] = HOMEBREW_PREFIX ENV['EXPAT_HOME'] = '/usr/' - system "cmake . #{std_cmake_parameters} -DENABLE_EXPAT:BOOL=ON" + system "cmake . #{std_cmake_parameters} -DENABLE_EXPAT:BOOL=ON -DENABLE_DBUS:BOOL=OFF" system "make install" end end
Fix Strigi to build when DBus installed and dependency naming.
diff --git a/lib/tasks/personal_information.rake b/lib/tasks/personal_information.rake index abc1234..def5678 100644 --- a/lib/tasks/personal_information.rake +++ b/lib/tasks/personal_information.rake @@ -1,4 +1,7 @@-task remove_old_personal_information: :environment do - cutoff = Time.zone.now - 6.months - Depersonalizer.new.remove_personal_information cutoff +namespace :anonymise do + desc 'Anonymise data that is at least 6 months old' + task remove_old_personal_information: :environment do + cutoff = Time.zone.now - 6.months + Depersonalizer.new.remove_personal_information cutoff + end end
Add namespace and description to rake task
diff --git a/lib/revertible_paper_trail/version.rb b/lib/revertible_paper_trail/version.rb index abc1234..def5678 100644 --- a/lib/revertible_paper_trail/version.rb +++ b/lib/revertible_paper_trail/version.rb @@ -9,11 +9,11 @@ def revert case event when "create" - item.destroy + self.item.destroy when "update" - reify.save + self.reify.save when "destroy" - reify.save + self.reify.save end end end
Add self. in revert action.
diff --git a/lib/traffic_light_controller/cli.rb b/lib/traffic_light_controller/cli.rb index abc1234..def5678 100644 --- a/lib/traffic_light_controller/cli.rb +++ b/lib/traffic_light_controller/cli.rb @@ -18,7 +18,7 @@ end def process_command_line_options - GetoptLong.new(*options_possible).each do |opt, arg| + GetoptLong.new(*options).each do |opt, arg| case opt when '--help' show_help_and_exit @@ -40,10 +40,14 @@ $0 = File.basename($0) << " (#{VERSION})" end + def options + options_possible.map{ |o| [o[0], o[1], o[2]]} + end + def options_possible [ - ['--help', '-h', GetoptLong::NO_ARGUMENT], - ['--version', '-V', GetoptLong::NO_ARGUMENT], + ['--help', '-h', GetoptLong::NO_ARGUMENT, 'Show this text'], + ['--version', '-V', GetoptLong::NO_ARGUMENT, 'Show version info'], ] end
Add help text for help message
diff --git a/lib/vines/stream/http/http_request.rb b/lib/vines/stream/http/http_request.rb index abc1234..def5678 100644 --- a/lib/vines/stream/http/http_request.rb +++ b/lib/vines/stream/http/http_request.rb @@ -3,18 +3,16 @@ module Vines class Stream class Http - class HttpState - class HttpRequest - attr_accessor :rid + class HttpRequest + attr_accessor :rid - def initialize(rid) - @rid = rid - @received = Time.now - end + def initialize(rid) + @rid = rid + @received = Time.now + end - def expired? - Time.now - @received > 55 - end + def expired? + Time.now - @received > 55 end end end
Move HttpRequest outside of HttpState class namespace.
diff --git a/has_roles.gemspec b/has_roles.gemspec index abc1234..def5678 100644 --- a/has_roles.gemspec +++ b/has_roles.gemspec @@ -16,4 +16,6 @@ s.extra_rdoc_files = %w(README.rdoc CHANGELOG.rdoc LICENSE) s.add_dependency("enumerate_by", ">= 0.4.0") + s.add_development_dependency("rake") + s.add_development_dependency("plugin_test_helper", ">= 0.3.2") end
Add missing dependencies to gemspec
diff --git a/modules/django.rb b/modules/django.rb index abc1234..def5678 100644 --- a/modules/django.rb +++ b/modules/django.rb @@ -24,3 +24,14 @@ end after "deploy:update", "django:syncdb" + +# depend :remote, :python_module, "module_name" +# runs #{python} and tries to import module_name. +class Capistrano::Deploy::RemoteDependency + def python_module(module_name, options={}) + @message ||= "Cannot import `#{module_name}'" + python = configuration.fetch(:python, "python") + try("#{python} -c 'import #{module_name}'", options) + self + end +end
Support for `depend :remote, :python_module, "module_name"' statement.
diff --git a/spec/integration/import_spec.rb b/spec/integration/import_spec.rb index abc1234..def5678 100644 --- a/spec/integration/import_spec.rb +++ b/spec/integration/import_spec.rb @@ -13,22 +13,51 @@ config.name = :main end end - - App.import(Umbrella) - Import = App.injector end end - let(:user_repo) do - Class.new { include Test::Import['core.db.repo'] }.new + shared_examples_for 'lazy booted dependency' do + it 'lazy boots an external dep provided by top-level container' do + expect(user_repo.repo).to be_instance_of(Db::Repo) + end + + it 'loads an external dep during finalization' do + system.finalize! + expect(user_repo.repo).to be_instance_of(Db::Repo) + end end - it 'lazy boots an external dep provided by top-level container' do - expect(user_repo.repo).to be_instance_of(Db::Repo) + context 'when top-lvl container provide the depedency' do + let(:user_repo) do + Class.new { include Test::Import['core.db.repo'] }.new + end + + let(:system) { Test::App } + + before do + module Test + App.import(Umbrella) + Import = App.injector + end + end + + it_behaves_like 'lazy booted dependency' end - it 'loads an external dep during finalization' do - Test::App.finalize! - expect(user_repo.repo).to be_instance_of(Db::Repo) + context 'when top-lvl container requires the dependency from the imported container' do + let(:user_repo) do + Class.new { include Test::Import['db.repo'] }.new + end + + let(:system) { Test::Umbrella } + + before do + module Test + Umbrella.import(App) + Import = Umbrella.injector + end + end + + it_behaves_like 'lazy booted dependency' end end
Extend spec for lazy-bootable deps
diff --git a/core/lib/spree/testing_support/factories/credit_card_factory.rb b/core/lib/spree/testing_support/factories/credit_card_factory.rb index abc1234..def5678 100644 --- a/core/lib/spree/testing_support/factories/credit_card_factory.rb +++ b/core/lib/spree/testing_support/factories/credit_card_factory.rb @@ -7,7 +7,7 @@ factory :credit_card, class: TestCard do verification_value 123 month 12 - year 2013 + year { Date.year } number '4111111111111111' end end
Update credit card factory to work any year.
diff --git a/sirportly.gemspec b/sirportly.gemspec index abc1234..def5678 100644 --- a/sirportly.gemspec +++ b/sirportly.gemspec @@ -5,7 +5,8 @@ s.name = 'sirportly' s.version = Sirportly::VERSION s.platform = Gem::Platform::RUBY - s.summary = "Easy to use client library for Sirportly" + s.summary = "Easy to use client library for Sirportly." + s.description = "A Ruby library for interacting with the Sirportly API." s.files = Dir["lib/sirportly.rb", 'lib/sirportly/**/*.rb'] s.bindir = "bin" s.require_path = 'lib'
Add a description to the gemspec.
diff --git a/spec/unit/veritas/aggregate/variance/class_methods/call_spec.rb b/spec/unit/veritas/aggregate/variance/class_methods/call_spec.rb index abc1234..def5678 100644 --- a/spec/unit/veritas/aggregate/variance/class_methods/call_spec.rb +++ b/spec/unit/veritas/aggregate/variance/class_methods/call_spec.rb @@ -13,18 +13,40 @@ let(:object) { described_class } context 'when the values are not nil' do - let(:values) { [ 1, 2, 3, 4, 5, 6 ] } + let(:values) { [-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6 ] } + let(:count) { values.count } + let(:mean) { 0.0 } + let(:sum_of_squares) { values.map { |value| value ** 2.0 }.reduce(:+) } - it 'returns the expected count, mean and sum_of_squares of the values' do - should eql([ 6, 3.5, 17.5 ]) + it 'returns the expected count' do + subject.fetch(0).should be(count) + end + + it 'returns the expected mean' do + subject.fetch(1).should eql(mean) + end + + it 'returns the expected sum of squares' do + subject.fetch(2).should eql(sum_of_squares) end end context 'when the values are nil' do - let(:values) { [ nil ] } + let(:values) { [ nil ] } + let(:count) { default.fetch(0) } + let(:mean) { default.fetch(1) } + let(:sum_of_squares) { default.fetch(2) } - it 'returns the default' do - should equal(default) + it 'returns the default count' do + subject.fetch(0).should be(count) + end + + it 'returns the default mean' do + subject.fetch(1).should eql(mean) + end + + it 'returns the default sum of squares' do + subject.fetch(2).should eql(sum_of_squares) end end end
Fix Aggregate::Variance.call spec to kill mutation
diff --git a/lib/botnet.rb b/lib/botnet.rb index abc1234..def5678 100644 --- a/lib/botnet.rb +++ b/lib/botnet.rb @@ -1,8 +1,11 @@ require 'json' +require 'whois' + + get '/' do erb :index end -post '/dns' do +post '/dns/' do # A, CNAME, AAAA, MX, NS respond_message "DNS Lookup" end @@ -11,14 +14,32 @@ respond_message "domain" end -post '/whois' do +post '/whois/' do respond_message "whois" end -post '/ping' do +post '/ping/' do respond_message "ping" end -post '/net' do +post '/net/' do respond_message "Help & feedback" +end +# for now only +get '/whois/?' do + result = Whois.whois("simplepoll.rocks") + puts result + result.to_json +end + +get '/ping/?' do # can't work on this, because windows :( + check = Net::Ping::External.new(host) + puts check + "Done" +end + +get '/domain/:domain/?' do + result = Whois.whois(params[:domain]) + is_available = result.available? ? "yes" : "no" + "Is " + params[:domain] + " available? " + is_available.to_s # this is some really messed up shit end def respond_message message content_type :json
Add whois and domain code :watch:
diff --git a/lib/botnet.rb b/lib/botnet.rb index abc1234..def5678 100644 --- a/lib/botnet.rb +++ b/lib/botnet.rb @@ -1,6 +1,6 @@ require 'json' require 'uri' -require 'http' +require 'net/http' get '/' do erb :index end
Fix require http to use net/http
diff --git a/lib/cadooz.rb b/lib/cadooz.rb index abc1234..def5678 100644 --- a/lib/cadooz.rb +++ b/lib/cadooz.rb @@ -25,4 +25,8 @@ end end -require_relative 'cadooz/business_order_service'+require_relative 'cadooz/business_order_service' +require_relative 'cadooz/catalog' +require_relative 'cadooz/generation_profile_product' +require_relative 'cadooz/order' +require_relative 'cadooz/product_category'
Add missing requires in config
diff --git a/lib/citrus.rb b/lib/citrus.rb index abc1234..def5678 100644 --- a/lib/citrus.rb +++ b/lib/citrus.rb @@ -1,10 +1,8 @@+require 'bundler' +Bundler.require(:default) + require 'securerandom' require 'json' -require 'webmachine' -require 'celluloid/zmq' -require 'celluloid_zmq_extensions' -require 'thor' -require 'httpclient' Celluloid.logger = nil
Make use of bundler require feature.
diff --git a/spec/page_spec.rb b/spec/page_spec.rb index abc1234..def5678 100644 --- a/spec/page_spec.rb +++ b/spec/page_spec.rb @@ -2,6 +2,7 @@ describe 'Page' do let(:site) { double } + let(:page) { Dimples::Page.new(site) } describe '#initialize' do context 'when a path is provided' do @@ -28,12 +29,52 @@ end context 'when no path is provided' do - let(:page) { Dimples::Page.new(site) } - it 'sets the default metadata and contents' do expect(page.contents).to eq('') expect(page.metadata).to eq({}) end end end + + describe '#filename' do + context 'with no filename provided in the metadata' do + it 'returns the default filename' do + expect(page.filename).to eq('index') + end + end + + context 'with a filename in the metadata' do + before do + page.metadata[:filename] = 'home' + end + + it 'overrides the default value' do + expect(page.filename).to eq('home') + end + end + end + + describe '#extension' do + context 'with no extension provided in the metadata' do + it 'returns the default extension' do + expect(page.extension).to eq('html') + end + end + + context 'with an extension in the metadata' do + before do + page.metadata[:extension] = 'txt' + end + + it 'overrides the default value' do + expect(page.extension).to eq('txt') + end + end + end + + describe '#render' do + end + + describe '#write' do + end end
Add filename and extension tests
diff --git a/spec/role_spec.rb b/spec/role_spec.rb index abc1234..def5678 100644 --- a/spec/role_spec.rb +++ b/spec/role_spec.rb @@ -1,25 +1,25 @@ require 'role' describe IMDB::Role do - let(:movie) { IMDB::Role.parse 'EuroTrip (2004) [Jenny] <6>' } + let(:role) { IMDB::Role.new 'EuroTrip (2004) [Jenny] <6>' } describe '#title' do it "returns the movie title" do - expect(movie.title).to eq("EuroTrip") + expect(role.title).to eq("EuroTrip") end end describe '#year' do it "returns the year of release" do - expect(movie.year).to eq(2004) + expect(role.year).to eq(2004) end end describe '#character' do it "returns the character name" do - expect(movie.character).to eq("Jenny") + expect(role.character).to eq("Jenny") end end describe '#credit' do it "returns the billing position in credits" do - expect(movie.credit).to eq(6) + expect(role.credit).to eq(6) end end end
Change movie to role and stricter parsing
diff --git a/app/controllers/team_name_controller.rb b/app/controllers/team_name_controller.rb index abc1234..def5678 100644 --- a/app/controllers/team_name_controller.rb +++ b/app/controllers/team_name_controller.rb @@ -38,7 +38,7 @@ def sign @colour = params[:colour] - @page_title = "#{params[:team_name]} – " @team_name = params[:team_name].gsub('_', '.').gsub('__', '_') + @page_title = "#{params[:team_name].gsub('_', '.').gsub('__', '_')} – " end end
Fix _ substitution in page title
diff --git a/app/controllers/paperclip_database_storage/attachments_controller.rb b/app/controllers/paperclip_database_storage/attachments_controller.rb index abc1234..def5678 100644 --- a/app/controllers/paperclip_database_storage/attachments_controller.rb +++ b/app/controllers/paperclip_database_storage/attachments_controller.rb @@ -13,9 +13,15 @@ raise ActionController::RoutingError.new('Too many images found. Check your route definition') if attachments.length > 1 attachment = attachments.first + + original_filename = attachment.attached.send(attachment.attached.attachment_definitions.select { |k, v| v[:storage] == :database }.keys.first).original_filename + original_extension = File.extname(original_filename) + filename = params[:filename] || original_filename + filename = "#{filename}#{original_extension}" unless filename =~ /#{original_extension}$/ + send_data attachment.file_data, :type => attachment.content_type, :disposition => (attachment.content_type.strip =~ /^image/ ? 'inline' : 'attachment'), - :filename => (params[:filename] || attachment.attached.send(attachment.attached.attachment_definitions.select { |k, v| v[:storage] == :database }.keys.first).original_filename) + :filename => filename end end
Add the extension to the filename (some browsers don't add them automatically from the content type)
diff --git a/lib/shoppu.rb b/lib/shoppu.rb index abc1234..def5678 100644 --- a/lib/shoppu.rb +++ b/lib/shoppu.rb @@ -1,7 +1,7 @@ require 'shoppu/version' -require 'shoppu/interactors/create_order' -require 'shoppu/repositories/orders_repo' -require 'shoppu/entities/order' +Dir[File.dirname(__FILE__) + "/shoppu/interactors/*.rb"].each {|file| require file } +Dir[File.dirname(__FILE__) + "/shoppu/repositories/*.rb"].each {|file| require file } +Dir[File.dirname(__FILE__) + "/shoppu/entities/*.rb"].each {|file| require file } module Shoppu # Your code goes here...
Add autoload for all files in dirs.
diff --git a/test/gir_ffi-cairo/context_test.rb b/test/gir_ffi-cairo/context_test.rb index abc1234..def5678 100644 --- a/test/gir_ffi-cairo/context_test.rb +++ b/test/gir_ffi-cairo/context_test.rb @@ -8,10 +8,11 @@ end end + let(:instance) { Cairo::Context.create(nil) } + describe "#get_target" do it "returns the context's target" do - obj = Cairo::Context.create(nil) - obj.get_target.must_be_instance_of Cairo::Surface + instance.get_target.must_be_instance_of Cairo::Surface end end end
Prepare Cairo::Context unit test for more tests of instance methods
diff --git a/hanitizer.gemspec b/hanitizer.gemspec index abc1234..def5678 100644 --- a/hanitizer.gemspec +++ b/hanitizer.gemspec @@ -4,20 +4,19 @@ require 'hanitizer/version' Gem::Specification.new do |spec| - spec.name = "hanitizer" + spec.name = 'hanitizer' spec.version = Hanitizer::VERSION - spec.authors = ["Dan Porter"] - spec.email = ["wolfpakz@gmail.com"] - spec.summary = %q{TODO: Write a short summary. Required.} - spec.description = %q{TODO: Write a longer description. Optional.} - spec.homepage = "" - spec.license = "MIT" - + spec.authors = ['Dan Porter'] + spec.email = ['wolfpak.z@gmail.com'] + spec.summary = %q{Data sanitizer for SQL databases} + spec.description = %q{Reduce the risks of having production data in the hands of developers.} + spec.homepage = 'https://github.com/wolfpakz/hanitizer' + spec.license = 'MIT' spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) - spec.require_paths = ["lib"] + spec.require_paths = ['lib'] - spec.add_development_dependency "bundler", "~> 1.5" - spec.add_development_dependency "rake" + spec.add_development_dependency 'bundler', '~> 1.5' + spec.add_development_dependency 'rake' end
Update email address and add descriptions to gemspec
diff --git a/i18n-spec.gemspec b/i18n-spec.gemspec index abc1234..def5678 100644 --- a/i18n-spec.gemspec +++ b/i18n-spec.gemspec @@ -7,7 +7,6 @@ s.required_ruby_version = ">= 2.3.0" s.require_paths = ["lib"] s.authors = ["Christopher Dell"] - s.date = "2014-10-27" s.description = "Includes a number of rspec matchers to make specing your locale files easy peasy." s.email = "chris@tigrish.com" s.extra_rdoc_files = [
Remove date attribute from gemspec `bundle gem` does not generate this attribute by default, I don't think it provides much value, and it's yet one more thing to keep up to date when releasing.
diff --git a/spec/overcommit/hook_context/pre_rebase_spec.rb b/spec/overcommit/hook_context/pre_rebase_spec.rb index abc1234..def5678 100644 --- a/spec/overcommit/hook_context/pre_rebase_spec.rb +++ b/spec/overcommit/hook_context/pre_rebase_spec.rb @@ -0,0 +1,91 @@+require 'spec_helper' +require 'overcommit/hook_context/pre_rebase' + +describe Overcommit::HookContext::PreRebase do + let(:config) { double('config') } + let(:args) { [upstream_branch, rebased_branch] } + let(:upstream_branch) { 'master' } + let(:rebased_branch) { 'topic' } + let(:input) { double('input') } + let(:context) { described_class.new(config, args, input) } + + describe '#upstream_branch' do + subject { context.upstream_branch } + + it { should == upstream_branch } + end + + describe '#rebased_branch' do + subject { context.rebased_branch } + + it { should == rebased_branch } + + context 'when rebasing current branch' do + let(:rebased_branch) { nil } + let(:current_branch) { 'master' } + + around do |example| + repo do + `git checkout -b #{current_branch} &> /dev/null` + example.run + end + end + + it { should == current_branch } + end + end + + describe '#fast_forward?' do + subject { context.fast_forward? } + + context 'when upstream branch is descendent from rebased branch' do + before do + context.stub(:rebased_commits).and_return([]) + end + + it { should == true } + end + + context 'when upstream branch is not descendent from rebased branch' do + before do + context.stub(:rebased_commits).and_return([random_hash]) + end + + it { should == false } + end + end + + describe '#rebased_commits' do + subject { context.rebased_commits } + + let(:base_branch) { 'master' } + let(:topic_branch_1) { 'topic-1' } + let(:topic_branch_2) { 'topic-2' } + + around do |example| + repo do + `git checkout -b #{base_branch} &> /dev/null` + `git commit --allow-empty -m "Initial Commit"` + `git checkout -b #{topic_branch_1} &> /dev/null` + `git commit --allow-empty -m "Hello World"` + `git checkout -b #{topic_branch_2} #{base_branch} &> /dev/null` + `git commit --allow-empty -m "Hello Again"` + example.run + end + end + + context 'when upstream branch is descendent from rebased branch' do + let(:upstream_branch) { topic_branch_1 } + let(:rebased_branch) { base_branch } + + it { should be_empty } + end + + context 'when upstream branch is not descendent from rebased branch' do + let(:upstream_branch) { topic_branch_1 } + let(:rebased_branch) { topic_branch_2 } + + it { should_not be_empty } + end + end +end
Add spec for PreRebase hook context
diff --git a/lib/rollout_ui.rb b/lib/rollout_ui.rb index abc1234..def5678 100644 --- a/lib/rollout_ui.rb +++ b/lib/rollout_ui.rb @@ -2,7 +2,9 @@ require 'rollout' require 'rollout_ui/monkey_patch' -if defined?(Rails) && Rails::VERSION::STRING.to_f > 3.1 +# Hack so we only load the engine when Rails will support it. +# TODO: find a better way +if defined?(Rails) && Rails::VERSION::STRING.to_f >= 3.1 $:.unshift File.expand_path("rollout_ui/engine/lib", File.dirname(__FILE__)) require 'rollout_ui/engine' end
Update check for installing Rails 3.1 engine
diff --git a/app/helpers/edits_helper.rb b/app/helpers/edits_helper.rb index abc1234..def5678 100644 --- a/app/helpers/edits_helper.rb +++ b/app/helpers/edits_helper.rb @@ -14,14 +14,9 @@ def mark_as_ham_or_spam(version) [ open_tag('button', :type => 'submit'), - spam_or_ham_label(version), + "This is #{version.spam_or_ham.capitalize}", "</button>" ].join("") end - - private - def spam_or_ham_label(version) - version.spam ? 'This Is Ham' : 'This Is Spam' - end end end
Remove a redundant helper method
diff --git a/app/helpers/guide_helper.rb b/app/helpers/guide_helper.rb index abc1234..def5678 100644 --- a/app/helpers/guide_helper.rb +++ b/app/helpers/guide_helper.rb @@ -4,7 +4,7 @@ "review_requested" => "warning", "ready" => "success", "published" => "info", - "unpublished" => "primary", + "unpublished" => "default", } def state_label(guide)
Make the Unpublish state gray
diff --git a/lib/tasks/qa.rake b/lib/tasks/qa.rake index abc1234..def5678 100644 --- a/lib/tasks/qa.rake +++ b/lib/tasks/qa.rake @@ -1,7 +1,9 @@ desc 'Run cane to check quality metrics' begin require 'cane/rake_task' - Cane::RakeTask.new(:quality) + Cane::RakeTask.new(:quality) do |cane| + cane.abc_max = 20 + end rescue LoadError task :quality puts 'Cane is not installed, :quality task unavailable'
Set abc complexity check to 20.
diff --git a/test/automated.rb b/test/automated.rb index abc1234..def5678 100644 --- a/test/automated.rb +++ b/test/automated.rb @@ -1,6 +1,8 @@-require_relative 'test_init' +ENV['TEST_BENCH_EXCLUDE_PATTERN'] ||= '/_|sketch|(_init\.rb|_tests\.rb)\z' +ENV['TEST_BENCH_TESTS_DIR'] ||= 'test/automated' -TestBench::Runner.( - 'automated/**/*.rb', - exclude_pattern: %r{\/_|sketch|(_init\.rb|_tests\.rb)\z} -) or exit 1 +require_relative './test_init' + +require 'test_bench/cli' + +TestBench::CLI.() or exit 1
Test runner is replaced with the TestBench CLI
diff --git a/test/spec.rb b/test/spec.rb index abc1234..def5678 100644 --- a/test/spec.rb +++ b/test/spec.rb @@ -1,8 +1,5 @@ require_relative 'test_init' -base_dir = File.expand_path(File.dirname(__FILE__)) -pattern = File.join base_dir, 'spec/postgresql_connector/*.rb' - -files = Dir.glob(pattern).reject { |file| file =~ /_init.rb\z/ } - -Runner.! files +Runner.! 'spec/postgresql_connector/*.rb' do |exclude| + exclude =~ /_init.rb\z/ +end
Test utility files are excluded from the suite using the runner's exclude block
diff --git a/ruby-gem/lib/crudecumber/crudecumber_steps.rb b/ruby-gem/lib/crudecumber/crudecumber_steps.rb index abc1234..def5678 100644 --- a/ruby-gem/lib/crudecumber/crudecumber_steps.rb +++ b/ruby-gem/lib/crudecumber/crudecumber_steps.rb @@ -2,7 +2,7 @@ # Essentially listens for the keys "return", "p", "f", "x" and "s" and then # decides whether to pass, fail or skip the step being run. -Then(/^.*$/) do +Then(/^.*$/) do | *x | Cucumber.trap_interrupt key = capture_key if skipped?(key)
Add optional parameter to Crudecumber's step definition
diff --git a/spec/models/manageiq/providers/openstack/cloud_manager/refresh_spec_environments.rb b/spec/models/manageiq/providers/openstack/cloud_manager/refresh_spec_environments.rb index abc1234..def5678 100644 --- a/spec/models/manageiq/providers/openstack/cloud_manager/refresh_spec_environments.rb +++ b/spec/models/manageiq/providers/openstack/cloud_manager/refresh_spec_environments.rb @@ -1,7 +1,7 @@ module Openstack module RefreshSpecEnvironments def allowed_enviroments - [:grizzly, :havana, :icehouse, :juno, :kilo, :kilo_keystone_v3] + [:grizzly, :havana, :icehouse, :juno, :kilo, :kilo_keystone_v3, :liberty] end def networking_service @@ -24,6 +24,8 @@ def environment_release_number case @environment + when :liberty + 8 when :kilo, :kilo_keystone_v3 7 when :juno
Add liberty to allowed VCR envs Add liberty to allowed VCR envs
diff --git a/test/html/pipeline/gitlab_gemoji_filter_test.rb b/test/html/pipeline/gitlab_gemoji_filter_test.rb index abc1234..def5678 100644 --- a/test/html/pipeline/gitlab_gemoji_filter_test.rb +++ b/test/html/pipeline/gitlab_gemoji_filter_test.rb @@ -5,20 +5,20 @@ GitLabEmojiFilter = HTML::Pipeline::GitLab::GitLabEmojiFilter def test_emojify - filter = GitLabEmojiFilter.new('<p>:heart:</p>', {:asset_root: 'https://foo.com'}) + filter = GitLabEmojiFilter.new('<p>:heart:</p>', {asset_root: 'https://foo.com'}) doc = filter.call assert_match 'https://foo.com/emoji/heart.png', doc.search('img').attr('src').value end def test_unsupported_emoji block = '<p>:sheep:</p>' - filter = GitLabEmojiFilter.new(block, {:asset_root: 'https://foo.com'}) + filter = GitLabEmojiFilter.new(block, {asset_root: 'https://foo.com'}) doc = filter.call assert_match block, doc.to_html end def test_uri_encoding - filter = GitLabEmojiFilter.new('<p>:+1:</p>', {:asset_root: 'https://foo.com'}) + filter = GitLabEmojiFilter.new('<p>:+1:</p>', {asset_root: 'https://foo.com'}) doc = filter.call assert_match 'https://foo.com/emoji/%2B1.png', doc.search('img').attr('src').value end
Use ruby 1.9 hash syntax
diff --git a/test/integration/default/inspec/default_spec.rb b/test/integration/default/inspec/default_spec.rb index abc1234..def5678 100644 --- a/test/integration/default/inspec/default_spec.rb +++ b/test/integration/default/inspec/default_spec.rb @@ -10,3 +10,8 @@ it { should be_symlink } it { should be_linked_to '/usr/local/bin/cmk' } end + +describe bash('cmk version') do + its('exit_status') { should eq(0) } + its('stdout') { should match('CloudMonkey') } +end
Add check if cmk actually is a binary and produces output
diff --git a/test/integration/elasticsearch_indexing_test.rb b/test/integration/elasticsearch_indexing_test.rb index abc1234..def5678 100644 --- a/test/integration/elasticsearch_indexing_test.rb +++ b/test/integration/elasticsearch_indexing_test.rb @@ -1,41 +1,39 @@ require "integration_test_helper" -require "cgi" class ElasticsearchIndexingTest < IntegrationTest + SAMPLE_DOCUMENT = { + "title" => "TITLE", + "description" => "DESCRIPTION", + "format" => "answer", + "link" => "/an-example-answer", + "indexable_content" => "HERE IS SOME CONTENT" + } + def setup stub_elasticsearch_settings - try_remove_test_index - @sample_document = { - "title" => "TITLE", - "description" => "DESCRIPTION", - "format" => "answer", - "link" => "/an-example-answer", - "indexable_content" => "HERE IS SOME CONTENT" - } + create_test_indexes end def teardown clean_test_indexes end - def test_should_indicate_success_in_response_code_when_adding_a_new_document - create_test_indexes - - post "/documents", @sample_document.to_json + def test_adding_a_document_to_the_search_index + post "/documents", SAMPLE_DOCUMENT.to_json assert last_response.ok? - assert_document_is_in_rummager(@sample_document) + assert_document_is_in_rummager(SAMPLE_DOCUMENT) end - def test_after_adding_a_document_to_index_should_be_able_to_retrieve_it_again_async + def test_adding_a_document_to_the_search_index_with_queue # the queue is disabled in testing by default, but testing/sidekiq/inline # executes jobs immediatly. app.settings.enable_queue = true - create_test_indexes - post "/documents", @sample_document.to_json + post "/documents", SAMPLE_DOCUMENT.to_json - assert_document_is_in_rummager(@sample_document) + assert_equal 202, last_response.status + assert_document_is_in_rummager(SAMPLE_DOCUMENT) end end
Clean up indexing integration test Rename the test methods, remove redundant code and make the code look better.
diff --git a/test/loop_test.rb b/test/loop_test.rb index abc1234..def5678 100644 --- a/test/loop_test.rb +++ b/test/loop_test.rb @@ -12,14 +12,14 @@ end should "loop for 100ms" do - i = 0 + start = Time.now + LoopHard.loop(timeout: 0.1) do - sleep 0.01 - i += 1 + # do nothing end - # Not an exact science, this thing... - assert_operator i, :>, 7 - assert_operator i, :<, 12 + time_elapsed = Time.now - start + + assert_in_delta 0.1, time_elapsed, 0.02 end end
Use Time.now to check timeout in test
diff --git a/0_code_wars/8_unexpected_parsing.rb b/0_code_wars/8_unexpected_parsing.rb index abc1234..def5678 100644 --- a/0_code_wars/8_unexpected_parsing.rb +++ b/0_code_wars/8_unexpected_parsing.rb @@ -0,0 +1,6 @@+# http://www.codewars.com/kata/54fdaa4a50f167b5c000005f/ +# --- iterations --- +def get_status(is_busy) + status = is_busy ? "busy" : "available" + return { "status" => status } +end
Add code wars (8) unexpected parsing
diff --git a/examples/pubsub.rb b/examples/pubsub.rb index abc1234..def5678 100644 --- a/examples/pubsub.rb +++ b/examples/pubsub.rb @@ -21,11 +21,11 @@ end on.message do |channel, message| - puts "##{klass}: #{message}" + puts "##{channel}: #{message}" redis.unsubscribe if message == "exit" end on.unsubscribe do |channel, subscriptions| - puts "Unsubscribed from ##{klass} (#{subscriptions} subscriptions)" + puts "Unsubscribed from ##{channel} (#{subscriptions} subscriptions)" end end
Fix PubSub example for a flawless first try.
diff --git a/kappamaki.gemspec b/kappamaki.gemspec index abc1234..def5678 100644 --- a/kappamaki.gemspec +++ b/kappamaki.gemspec @@ -21,9 +21,10 @@ spec.require_paths = ['lib'] spec.add_development_dependency 'bundler' + spec.add_development_dependency 'coveralls' + spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec' spec.add_development_dependency 'rubocop' - spec.add_development_dependency 'coveralls' spec.required_ruby_version = '>= 1.9.3' end
Add rake as a dependency
diff --git a/lib/antir/core.rb b/lib/antir/core.rb index abc1234..def5678 100644 --- a/lib/antir/core.rb +++ b/lib/antir/core.rb @@ -1,11 +1,12 @@-require 'singleton' +#require 'singleton' module Antir - class Core - attr_reader :address - include Singleton + class Core < Antir::Resources::Core + #attr_reader :address + #include Singleton - def load_config(config_path) + @@local = Antir::Resources::Core.first + def @@local.load_config(config_path) config = YAML.load_file(config_path) begin @address = config['core']['host'] @@ -16,7 +17,7 @@ end end - def start + def @@local.start @dispatcher = Antir::Core::Dispatcher.instance @worker_pool = Antir::Core::WorkerPool.new(@worker_ports) @@ -26,9 +27,13 @@ @dispatcher.start end - def self.method_missing(name, *args) - instance.send(name, *args) + def self.local + @@local end + + #def self.method_missing(name, *args) + # instance.send(name, *args) + #end end end
Test on singleton object Core
diff --git a/lib/engineyard.rb b/lib/engineyard.rb index abc1234..def5678 100644 --- a/lib/engineyard.rb +++ b/lib/engineyard.rb @@ -1,7 +1,7 @@ module EY require 'engineyard/ruby_ext' - VERSION = "0.3.3" + VERSION = "0.3.4.pre" autoload :API, 'engineyard/api' autoload :Collection, 'engineyard/collection'
Add .pre for next version Change-Id: Ibbd5b122c4856bb1ab28cd81d6a39ea51da6ca8d
diff --git a/lib/epub/spine.rb b/lib/epub/spine.rb index abc1234..def5678 100644 --- a/lib/epub/spine.rb +++ b/lib/epub/spine.rb @@ -5,11 +5,6 @@ def initialize(epub) @epub = epub - end - - - def xmldoc - @epub.opf_xml.xpath(OPF_XPATH).first end @@ -40,7 +35,13 @@ toc_manifest_id.to_s.strip end + private + + + def xmldoc + @epub.opf_xml.xpath(OPF_XPATH).first + end def nodes xmldoc.xpath(OPF_ITEM_XPATH).each do |node|
Move xmldoc to private scope.
diff --git a/test/trackler_test.rb b/test/trackler_test.rb index abc1234..def5678 100644 --- a/test/trackler_test.rb +++ b/test/trackler_test.rb @@ -14,7 +14,7 @@ assert_nil Trackler.problems.detect { |p| p.slug == "snowflake-only" } end - def test_problems_does_not_contain_track_specific_problems + def test_implementations_does_contain_track_specific_problems Trackler.use_fixture_data refute_nil Trackler.implementations['snowflake-only']
Change test name to reflect what is being tested
diff --git a/app/decorators/user_decorator.rb b/app/decorators/user_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/user_decorator.rb +++ b/app/decorators/user_decorator.rb @@ -6,11 +6,7 @@ end def general_info_print - if object.company_name.present? - "<b>#{object.company_name.upcase}:</b> #{full_name.upcase}" - else - full_name.upcase - end + "<b>#{object.company_name.upcase}" end def applicant_info_print
Change to pdf company name
diff --git a/active-model-adapter-source.gemspec b/active-model-adapter-source.gemspec index abc1234..def5678 100644 --- a/active-model-adapter-source.gemspec +++ b/active-model-adapter-source.gemspec @@ -14,5 +14,5 @@ gem.add_dependency "ember-source", ">= 1.8", "< 3.0" - gem.files = %w(package.json) + Dir['dist/active-model*.js'] + Dir['lib/ember/data/*.rb'] + gem.files = %w(package.json) + Dir['dist/active-model*.js'] + Dir['lib/ember/data/**/*.rb'] end
Add missing `.rb` files to be bundled to active-model-adapter gem
diff --git a/spec/unit/imap/backup/uploader_spec.rb b/spec/unit/imap/backup/uploader_spec.rb index abc1234..def5678 100644 --- a/spec/unit/imap/backup/uploader_spec.rb +++ b/spec/unit/imap/backup/uploader_spec.rb @@ -0,0 +1,40 @@+require "spec_helper" + +describe Imap::Backup::Uploader do + subject { described_class.new(folder, serializer) } + + let(:folder) do + instance_double(Imap::Backup::Account::Folder, uids: [2, 3], append: 99) + end + let(:serializer) do + instance_double( + Imap::Backup::Serializer::Mbox, + uids: [1, 2], + update_uid: nil + ) + end + + describe "#run" do + before do + allow(serializer).to receive(:load).with(1) { "missing message" } + allow(serializer).to receive(:load).with(2) { "existing message" } + subject.run + end + + context "with messages that are missing" do + it "restores them" do + expect(folder).to have_received(:append).with("missing message") + end + + it "updates the local message id" do + expect(serializer).to have_received(:update_uid).with(1, 99) + end + end + + context "with messages that are present on server" do + it "does nothing" do + expect(folder).to_not have_received(:append).with("existing message") + end + end + end +end
Add unit tests for uploader
diff --git a/app/controllers/peoplefinder/information_requests_controller.rb b/app/controllers/peoplefinder/information_requests_controller.rb index abc1234..def5678 100644 --- a/app/controllers/peoplefinder/information_requests_controller.rb +++ b/app/controllers/peoplefinder/information_requests_controller.rb @@ -5,7 +5,8 @@ def new @information_request = InformationRequest.new( recipient: @person, - message: I18n.t('peoplefinder.controllers.information_requests.default_message', + message: I18n.t( + 'peoplefinder.controllers.information_requests.default_message', recipient: @person, sender: current_user) )
Fix line length for rubocop
diff --git a/lib/brainstem/dsl/conditionals_block.rb b/lib/brainstem/dsl/conditionals_block.rb index abc1234..def5678 100644 --- a/lib/brainstem/dsl/conditionals_block.rb +++ b/lib/brainstem/dsl/conditionals_block.rb @@ -2,12 +2,29 @@ module Concerns module PresenterDSL class ConditionalsBlock < BaseBlock - def request(name, action, description = nil) - configuration[:conditionals][name] = DSL::Conditional.new(name, :request, action, description) + def request(name, action, *args) + options = parse_args(args) + configuration[:conditionals][name] = DSL::Conditional.new(name, :request, action, options) end - def model(name, action, description = nil) - configuration[:conditionals][name] = DSL::Conditional.new(name, :model, action, description) + def model(name, action, *args) + options = parse_args(args) + configuration[:conditionals][name] = DSL::Conditional.new(name, :model, action, options) + end + end + + private + + def parse_args(args) + if args.length == 1 + description = args.first + if description.is_a?(String) + { info: description } + else + description + end + else + super(args) end end end
Allow passing in description as the info option for conditionals
diff --git a/lib/metric_fu/metrics/flay/generator.rb b/lib/metric_fu/metrics/flay/generator.rb index abc1234..def5678 100644 --- a/lib/metric_fu/metrics/flay/generator.rb +++ b/lib/metric_fu/metrics/flay/generator.rb @@ -16,9 +16,14 @@ end def to_h + {:flay => calculate_result(@matches)} + end + + # TODO: move into analyze method + def calculate_result(matches) + total_score = matches.shift.first.split('=').last.strip target = [] - total_score = @matches.shift.first.split('=').last.strip - @matches.each do |problem| + matches.each do |problem| reason = problem.shift.strip lines_info = problem.map do |full_line| name, line = full_line.split(":").map(&:strip) @@ -26,7 +31,10 @@ end target << [:reason => reason, :matches => lines_info] end - {:flay => {:total_score => total_score, :matches => target.flatten}} + { + :total_score => total_score, + :matches => target.flatten + } end private
Move flay result calculation out of to_h
diff --git a/lib/parelation/criteria/order/object.rb b/lib/parelation/criteria/order/object.rb index abc1234..def5678 100644 --- a/lib/parelation/criteria/order/object.rb +++ b/lib/parelation/criteria/order/object.rb @@ -1,4 +1,12 @@ class Parelation::Criteria::Order::Object + + # @return [Hash] the possible directions (asc, desc) + # for database queries. + # + DIRECTIONS = { + "asc" => :asc, + "desc" => :desc, + } # @return [String] # @@ -28,14 +36,10 @@ end # @return [Symbol, nil] the direction to order {#field}, - # eiter :asc or :desc. + # either :asc or :desc. # def direction - case parts.last - when "asc" then :asc - when "desc" then :desc - else nil - end + DIRECTIONS[parts.last] end # @return [Array<String, nil>] the criteria chunks (separated by +:+).
Use a Hash to map the direction ("asc", "desc") to :asc and :desc so we can avoid the use of a switch statement. Fixed a small typo.
diff --git a/hbase-jruby.gemspec b/hbase-jruby.gemspec index abc1234..def5678 100644 --- a/hbase-jruby.gemspec +++ b/hbase-jruby.gemspec @@ -19,5 +19,6 @@ gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] + gem.add_development_dependency 'yard' gem.add_development_dependency 'simplecov' end
Add yard as a development dependency
diff --git a/app/controllers/spree/admin/review_settings_controller.rb b/app/controllers/spree/admin/review_settings_controller.rb index abc1234..def5678 100644 --- a/app/controllers/spree/admin/review_settings_controller.rb +++ b/app/controllers/spree/admin/review_settings_controller.rb @@ -1,9 +1,7 @@ class Spree::Admin::ReviewSettingsController < Spree::Admin::BaseController def update # workaround for unset checkbox behaviour - %i[include_unapproved_reviews feedback_rating show_email require_login - track_locale].each do |sym| - + %w(include_unapproved_reviews feedback_rating show_email require_login track_locale).each do |sym| params[:preferences][sym] = false if params[:preferences][sym].blank? end
Update syntax to work on Ruby 1.9.3.
diff --git a/trade_tracker.gemspec b/trade_tracker.gemspec index abc1234..def5678 100644 --- a/trade_tracker.gemspec +++ b/trade_tracker.gemspec @@ -22,5 +22,5 @@ spec.add_development_dependency 'rake' spec.add_development_dependency 'rspec', '~> 2.6' - spec.add_dependency 'activesupport' + spec.add_dependency 'activesupport', '>= 3.2' end
Set an actual activesupport dependency.
diff --git a/app/controllers/bitly_controller.rb b/app/controllers/bitly_controller.rb index abc1234..def5678 100644 --- a/app/controllers/bitly_controller.rb +++ b/app/controllers/bitly_controller.rb @@ -0,0 +1,19 @@+class BitlyController < ApplicationController + def new + # u = Bitly.client.shorten(params["url"]) + u = Bitly.client.shorten("http://cfemoneyowednys.org") + p u + p u.short_url + # p u + # if !(u) + # u = Bitly.client.shorten("http://cfemoneyowednys.org") + # return @url = u.short_url + # end + @json = u.short_url + respond_to do |format| + format.html + format.json { render json: @json } + end + end + +end
Add controller for ajax version of bitly
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,12 +1,6 @@ class UsersController < SecuredController - def edit - user = User.find(params[:id]) - if user == current_user - render "edit" - else - redirect '/' - end + @user = current_user + render "edit" end - end
Fix route so it will only return the current user's edit path
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,6 +1,6 @@ class UsersController < ApplicationController before_action :authenticate_user!, except: [:new, :create] - if Rails.env == 'production' + if Rails.env == 'production' && ENV['SELF_HOSTED'].blank? http_basic_authenticate_with name: ENV['HTTP_AUTH_USERNAME'], password: ENV['HTTP_AUTH_PASSWORD'] end
Add env var to http_basic_auth conditonal.
diff --git a/app/models/concerns/bank_holiday.rb b/app/models/concerns/bank_holiday.rb index abc1234..def5678 100644 --- a/app/models/concerns/bank_holiday.rb +++ b/app/models/concerns/bank_holiday.rb @@ -8,7 +8,10 @@ private def read_bank_holidays - return [] unless File.exists?(bank_holidays_file) + unless File.exists?(bank_holidays_file) + Rails.logger.error("--- ERROR: --- Tried to access Bank Holiday file which could not be found") + return [] + end Icalendar.parse(File.open(bank_holidays_file)).first.events.map(&:dtstart) end
Throw error message into the log if trying to check for Bank Holidays without a file
diff --git a/app/models/spree/order_decorator.rb b/app/models/spree/order_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/order_decorator.rb +++ b/app/models/spree/order_decorator.rb @@ -27,7 +27,8 @@ gift_name: li.gift_name, gift_email: li.gift_email, gift_message: li.gift_message, - line_item: li + line_item: li, + order_number: number ) end end
Save the Order number when a new Subscription is created
diff --git a/app/models/container_template.rb b/app/models/container_template.rb index abc1234..def5678 100644 --- a/app/models/container_template.rb +++ b/app/models/container_template.rb @@ -14,4 +14,8 @@ serialize :object_labels, Hash acts_as_miq_taggable + + def instantiate(_params, _project_name) + raise NotImplementedError, _("instantiate must be implemented in a subclass") + end end
Add instantiate interface method in the base ContainerTemplate model.
diff --git a/app/models/spree/volume_price.rb b/app/models/spree/volume_price.rb index abc1234..def5678 100644 --- a/app/models/spree/volume_price.rb +++ b/app/models/spree/volume_price.rb @@ -11,25 +11,28 @@ in: %w(price dollar percent), message: I18n.t(:'activerecord.errors.messages.is_not_a_valid_volume_price_type', value: self) } - validates :range, - format: { - with: /\(?[0-9]+(?:\.{2,3}[0-9]+|\+\)?)/, - message: I18n.t(:'activerecord.errors.messages.must_be_in_format') - } - OPEN_ENDED = /\(?[0-9]+\+\)?/ + validate :range_format def include?(quantity) - if open_ended? - bound = /\d+/.match(range)[0].to_i - return quantity >= bound - else - range.to_range === quantity - end + range_from_string.include?(quantity) end # indicates whether or not the range is a true Ruby range or an open ended range with no upper bound def open_ended? - OPEN_ENDED =~ range + range_from_string.end == Float::INFINITY + end + + private + + def range_format + if !(SolidusVolumePricing::RangeFromString::RANGE_FORMAT =~ range || + SolidusVolumePricing::RangeFromString::OPEN_ENDED =~ range) + errors.add(:range, :must_be_in_format) + end + end + + def range_from_string + SolidusVolumePricing::RangeFromString.new(range).to_range end end
Refactor Spree::VolumePrice to use new Converter
diff --git a/lib/exlibris/aleph/api/client/patron/record/item/hold.rb b/lib/exlibris/aleph/api/client/patron/record/item/hold.rb index abc1234..def5678 100644 --- a/lib/exlibris/aleph/api/client/patron/record/item/hold.rb +++ b/lib/exlibris/aleph/api/client/patron/record/item/hold.rb @@ -8,28 +8,16 @@ class Hold < Base attr_reader :patron_id, :record_id, :item_id, :parameters - def initialize(patron_id, record_id, item_id, parameters=nil) + def initialize(patron_id, record_id, item_id) @patron_id = patron_id @record_id = record_id @item_id = item_id - unless parameters.nil? - unless parameters.is_a?(Parameters) - raise ArgumentError.new("Expecting #{parameters} to be a Parameters") - end - @parameters = parameters - @request_method = :put - end end protected def path @path ||= "#{super}/patron/#{patron_id}/record/#{record_id}/items/#{item_id}/hold" - end - - private - def put - connection.put(path, "post_xml=#{parameters.to_xml}") end end end
Remove unnecessary parameters input argument from the Hold API client since the Hold creation call has been moved to it's own object.
diff --git a/lib/generators/install/templates/microservices_engine.rb b/lib/generators/install/templates/microservices_engine.rb index abc1234..def5678 100644 --- a/lib/generators/install/templates/microservices_engine.rb +++ b/lib/generators/install/templates/microservices_engine.rb @@ -30,12 +30,13 @@ ) response_data = JSON.parse(response.body) + MicroservicesEngine::Connection.destroy_all response_data.each do |service| - if service["models"].present? - url = service["url"] - service["models"].each do |model| - object = model["name"] - MicroservicesEngine::Connection.new(url: url, object: object) + if service['models'].present? + url = service['url'] + service['models'].each do |model| + object = model['name'] + MicroservicesEngine::Connection.create(url: url, object: object) end end end
Destroy all connections beforehand, make new ones from the list And convert double quotes to single quotes
diff --git a/lib/open_food_network/available_payment_method_filter.rb b/lib/open_food_network/available_payment_method_filter.rb index abc1234..def5678 100644 --- a/lib/open_food_network/available_payment_method_filter.rb +++ b/lib/open_food_network/available_payment_method_filter.rb @@ -5,12 +5,12 @@ def filter!(payment_methods) if stripe_enabled? payment_methods.to_a.reject! do |payment_method| - payment_method.type.ends_with?("StripeConnect") && + payment_method.type.ends_with?("StripeSCA") && stripe_configuration_incomplete?(payment_method) end else payment_methods.to_a.reject! do |payment_method| - payment_method.type.ends_with?("StripeConnect") + payment_method.type.ends_with?("StripeSCA") end end end
Switch filter to StripeSCA, this must have been an error, must be tested (manually or automatically)
diff --git a/app/helpers/google_analytics/analytics_helper.rb b/app/helpers/google_analytics/analytics_helper.rb index abc1234..def5678 100644 --- a/app/helpers/google_analytics/analytics_helper.rb +++ b/app/helpers/google_analytics/analytics_helper.rb @@ -4,6 +4,6 @@ end def render_google_analytics? - Rails.env.production? && site.google_analytics_code? && !controller.env['wheelhouse.preview'] + Rails.env.production? && site.google_analytics_code? && !request.env['wheelhouse.preview'] end end
Fix reference to Rack env
diff --git a/octopress-codefence.gemspec b/octopress-codefence.gemspec index abc1234..def5678 100644 --- a/octopress-codefence.gemspec +++ b/octopress-codefence.gemspec @@ -16,6 +16,9 @@ gem.add_runtime_dependency 'octopress-pygments', '>= 1.1.0' gem.add_runtime_dependency 'jekyll-page-hooks', '>= 1.0.2' + gem.add_development_dependency 'rake' + gem.add_development_dependency 'rspec' + gem.files = `git ls-files`.split($/) gem.require_paths = ["lib"] end
Add rake and rspec to bundle
diff --git a/lib/friendly_id/sequential_slug_generator.rb b/lib/friendly_id/sequential_slug_generator.rb index abc1234..def5678 100644 --- a/lib/friendly_id/sequential_slug_generator.rb +++ b/lib/friendly_id/sequential_slug_generator.rb @@ -16,18 +16,12 @@ private def next_sequence_number - if last_sequence_number == 0 - 2 - else - last_sequence_number + 1 - end + last_sequence_number ? last_sequence_number + 1 : 2 end def last_sequence_number - if slug_conflicts.size > 1 - slug_conflicts.last.split("#{slug}#{sequence_separator}").last.to_i - else - 0 + if match = /#{slug}#{sequence_separator}(\d+)/.match(slug_conflicts.last) + match[1].to_i end end
Use Regular expression for matching sequence numbers
diff --git a/lib/generators/data_migration/templates/data_migration.rb b/lib/generators/data_migration/templates/data_migration.rb index abc1234..def5678 100644 --- a/lib/generators/data_migration/templates/data_migration.rb +++ b/lib/generators/data_migration/templates/data_migration.rb @@ -5,4 +5,4 @@ def down raise ActiveRecord::IrreversibleMigration end -end+end
Add a missing newline to the end of template file Add a newline to the end of template file because some code checking tools warn when a file has no newline at the end.
diff --git a/CalSmokeApp/config/xtc-other-gems.rb b/CalSmokeApp/config/xtc-other-gems.rb index abc1234..def5678 100644 --- a/CalSmokeApp/config/xtc-other-gems.rb +++ b/CalSmokeApp/config/xtc-other-gems.rb @@ -2,7 +2,7 @@ gem "cucumber", "~> 2.0" gem "xamarin-test-cloud", "~> 2.0" gem 'rake', '~> 10.3' -gem 'bundler', '~> 1.6' +gem 'bundler', '2.0.2' gem 'xcpretty', '~> 0.1' gem 'rspec', '~> 3.0' gem 'pry'
Update bundler for testcloud testing
diff --git a/BTree.podspec b/BTree.podspec index abc1234..def5678 100644 --- a/BTree.podspec +++ b/BTree.podspec @@ -8,7 +8,7 @@ spec.summary = 'In-memory B-trees and ordered collections in Swift' spec.author = 'Károly Lőrentey' spec.homepage = 'https://github.com/lorentey/BTree' - spec.license = { :type => 'MIT', :file => 'LICENCE.md' } + spec.license = { :type => 'MIT', :file => 'LICENSE.md' } spec.source = { :git => 'https://github.com/lorentey/BTree.git', :tag => 'v3.1.0' } spec.source_files = 'Sources/*.swift' spec.social_media_url = 'https://twitter.com/lorentey'
Fix path to license file
diff --git a/lib/libxml.rb b/lib/libxml.rb index abc1234..def5678 100644 --- a/lib/libxml.rb +++ b/lib/libxml.rb @@ -1,5 +1,12 @@ # $Id$ # Please see the LICENSE file for copyright and distribution information + +# If running on Windows, then add the current directory to the PATH +# for the current process so it can find the pre-built libxml2 and +# iconv2 shared libraries (dlls). +if RUBY_PLATFORM.match(/mswin/i) + ENV['PATH'] += ";#{File.dirname(__FILE__)}" +end # Load the C-based binding. require 'libxml_ruby'
Check in windows path hack.
diff --git a/lib/device_runs.rb b/lib/device_runs.rb index abc1234..def5678 100644 --- a/lib/device_runs.rb +++ b/lib/device_runs.rb @@ -9,12 +9,24 @@ @uri, @client = uri, client end def download_scrshots_zip(file_name="screenshots.zip") + if(screenshots_u_r_i.nil? || screenshots_u_r_i.empty? ) + puts "Screenshots are not available" + return nil + end @client.download(screenshots_u_r_i, "screenshots.zip", file_name) end def download_junit(file_name="junit.xml") + if(junit_u_r_i.nil? || junit_u_r_i.empty? ) + puts "Junit result is not available" + return nil + end @client.download(junit_u_r_i, "junit XML", file_name) end def download_logcat(file_name="logcat.txt") + if(log_u_r_i.nil? || log_u_r_i.empty? ) + puts "Logcat output is not available" + return nil + end @client.download(log_u_r_i, "log", file_name) end end
Check the urls before downloading
diff --git a/lib/mercure/ipa.rb b/lib/mercure/ipa.rb index abc1234..def5678 100644 --- a/lib/mercure/ipa.rb +++ b/lib/mercure/ipa.rb @@ -7,6 +7,8 @@ require_relative 'paths.rb' def generateIpa settings + + system "mkdir -p \"#{buildDirectory}/logs/\"" buildDirectory = settings[:buildDirectory] buildConfiguration = settings[:buildConfiguration] @@ -34,7 +36,7 @@ signingCommand += " --embed \"#{provisioningProfile}\"" signingCommand += " | tee \"#{buildDirectory}/logs/#{applicationName}_package.log\"" - puts signingCommand + system("echo \"#{signingCommand}\" | tee \"#{buildDirectory}/logs/#{applicationName}_package.log\" ") system signingCommand system("rm -R -f \"#{savedDsymPath}\"")
Create logs directory if it doesn't exits
diff --git a/lib/peeek/calls.rb b/lib/peeek/calls.rb index abc1234..def5678 100644 --- a/lib/peeek/calls.rb +++ b/lib/peeek/calls.rb @@ -6,7 +6,7 @@ # @param [String, Regexp] file name or pattern of a file # @return [Peeek::Calls] filtered calls def in(file) - select { |call| file === call.file } + Calls.new(select { |call| file === call.file }) end # Filter the calls by line number. @@ -14,7 +14,7 @@ # @param [Number] line line number # @return [Peeek::Calls] filtered calls def at(line) - select { |call| call.line == line } + Calls.new(select { |call| call.line == line }) end # Filter the calls by a receiver. @@ -22,7 +22,7 @@ # @param [Module, Class, Object] receiver # @return [Peeek::Calls] filtered calls def from(receiver) - select { |call| call.receiver == receiver } + Calls.new(select { |call| call.receiver == receiver }) end end
Return a instance of Peeek::Calls
diff --git a/lib/shaper.rb b/lib/shaper.rb index abc1234..def5678 100644 --- a/lib/shaper.rb +++ b/lib/shaper.rb @@ -3,3 +3,10 @@ require 'shaper/property_shaper' require 'shaper/association_shaper' require 'shaper/data_visitor' +require 'shaper/renderers' + +module Shaper + extend ActiveSupport::Concern + include Shaper::Base + include Shaper::Renderers +end
Make it easier to include.
diff --git a/config/initializers/variables.rb b/config/initializers/variables.rb index abc1234..def5678 100644 --- a/config/initializers/variables.rb +++ b/config/initializers/variables.rb @@ -1 +1 @@-ENV['METRICS_LISTENER_URL'] ||= "http://loomio-metrics.s3.amazonaws.com/js/metrics_listener.js?v=1.0" +ENV['METRICS_LISTENER_URL'] ||= "https://loomio-metrics.s3.amazonaws.com/js/metrics_listener.js?v=1.0"
Use https for metrics collector script
diff --git a/app/controllers/admin/answers_controller.rb b/app/controllers/admin/answers_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/answers_controller.rb +++ b/app/controllers/admin/answers_controller.rb @@ -19,4 +19,25 @@ @answer = resource @latest_edition = resource.latest_edition end + + def progress + @answer = resource + @latest_edition = resource.latest_edition + notes = '' + + case params[:activity] + when 'request_review' + current_user.request_review(@latest_edition, notes) + when 'review' + current_user.review(@latest_edition, notes) + when 'okay' + current_user.okay(@latest_edition, notes) + when 'publish' + current_user.publish(@latest_edition, notes) + end + + @latest_edition.save + + redirect_to admin_answer_path(@answer), :notice => 'Answer updated' + end end
Add way to 'progress' answers
diff --git a/Casks/revisions.rb b/Casks/revisions.rb index abc1234..def5678 100644 --- a/Casks/revisions.rb +++ b/Casks/revisions.rb @@ -1,6 +1,6 @@ cask :v1 => 'revisions' do - version '2.0.1' - sha256 'd9eaa948cdc9cf40ffa8c56e5ea03c5afd54f254aa5f18ee1054d551e406f262' + version '2.0.2' + sha256 'df6a238771d30d686cae91b72dd95a31ebe35e73354a08c162eb4ea4b9235836' url "https://revisionsapp.com/downloads/revisions-#{version}.dmg" name 'Revisions'
Update Revisions to versions 2.0.2 This commit updates the version and sha256 stanzas
diff --git a/messaging.gemspec b/messaging.gemspec index abc1234..def5678 100644 --- a/messaging.gemspec +++ b/messaging.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'evt-messaging' - s.version = '1.3.0.1' + s.version = '1.3.0.2' s.summary = 'Common primitives for platform-specific messaging implementations for Eventide' s.description = ' '
Package version is increased from 1.3.0.1 to 1.3.0.2