diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/aoede/attributes/base.rb b/lib/aoede/attributes/base.rb index abc1234..def5678 100644 --- a/lib/aoede/attributes/base.rb +++ b/lib/aoede/attributes/base.rb @@ -5,7 +5,7 @@ module Base extend ActiveSupport::Concern - ATTRIBUTES = [:album, :artist, :comment, :genre, :title, :track, :year] + ATTRIBUTES = [:album, :artist, :comment, :genre, :title, :track_number, :release_date] MAPPING = Hash.new # @return [Hash] @@ -20,6 +20,37 @@ attrs end + + # @param method_name [Symbol, String] + # @param method [Symbol, String] + def define_attribute_getter(method_name, method) + define_method(method_name) do + audio.tag.send(method) + end + end + module_function :define_attribute_getter + + # @param method_name [Symbol, String] + # @param method [Symbol, String] + def define_attribute_setter(method_name, method) + define_method("#{method_name}=") do |value| + audio.tag.send("#{method}=", value) + end + end + module_function :define_attribute_setter + + # Define module attributes getters and setters dynamically + ATTRIBUTES.each do |method_name| + mapping = { + track_number: :track, + release_date: :year + } + + method = mapping[method_name] ? mapping[method_name] : method_name + + define_attribute_getter(method_name, method) + define_attribute_setter(method_name, method) + end end end end
Define default attribute methods on Attributes::Base
diff --git a/lib/gir_ffi/in_out_pointer.rb b/lib/gir_ffi/in_out_pointer.rb index abc1234..def5678 100644 --- a/lib/gir_ffi/in_out_pointer.rb +++ b/lib/gir_ffi/in_out_pointer.rb @@ -37,10 +37,6 @@ end end - def clear - put_bytes 0, "\x00" * value_type_size, 0, value_type_size - end - def self.allocate_new(type) ffi_type = TypeMap.type_specification_to_ffi_type type ptr = AllocationHelper.allocate_for_type(ffi_type) @@ -52,9 +48,5 @@ def value_ffi_type @value_ffi_type ||= TypeMap.type_specification_to_ffi_type value_type end - - def value_type_size - @value_type_size ||= FFI.type_size value_ffi_type - end end end
Remove unused methods from InOutPointer
diff --git a/lib/mspec/runner/exception.rb b/lib/mspec/runner/exception.rb index abc1234..def5678 100644 --- a/lib/mspec/runner/exception.rb +++ b/lib/mspec/runner/exception.rb @@ -1,3 +1,6 @@+# Initialize $MSPEC_DEBUG +$MSPEC_DEBUG = false unless defined?($MSPEC_DEBUG) + class ExceptionState attr_reader :description, :describe, :it, :exception
Make sure $MSPEC_DEBUG is initialized
diff --git a/lib/perpetuity/validations.rb b/lib/perpetuity/validations.rb index abc1234..def5678 100644 --- a/lib/perpetuity/validations.rb +++ b/lib/perpetuity/validations.rb @@ -36,21 +36,31 @@ class Length def initialize attribute, options @attribute = attribute - @options = options - - if range = options.delete(:between) - @options[:at_least] ||= range.min - @options[:at_most] ||= range.max + options.each do |option, value| + send option, value end end def pass? object length = object.send(@attribute).length - return false unless @options[:at_least].nil? or @options[:at_least] <= length - return false unless @options[:at_most].nil? or @options[:at_most] >= length + return false unless @at_least.nil? or @at_least <= length + return false unless @at_most.nil? or @at_most >= length true + end + + def at_least value + @at_least = value + end + + def at_most value + @at_most = value + end + + def between range + at_least range.min + at_most range.max end end end
Use dynamic method dispatch for length validation
diff --git a/lib/sequelizer/yaml_config.rb b/lib/sequelizer/yaml_config.rb index abc1234..def5678 100644 --- a/lib/sequelizer/yaml_config.rb +++ b/lib/sequelizer/yaml_config.rb @@ -23,7 +23,7 @@ # or +nil+ if config/database.yml doesn't exist def options return {} unless config_file_path.exist? - config['adapter'] ? config : config[environment] + config['adapter'] || config[:adapter] ? config : config[environment] end # The environment to load from database.yml
Check for symbols in YamlConfig as well
diff --git a/mailchimp.gemspec b/mailchimp.gemspec index abc1234..def5678 100644 --- a/mailchimp.gemspec +++ b/mailchimp.gemspec @@ -26,4 +26,5 @@ s.add_development_dependency('mocha') s.add_development_dependency('cover_me') s.add_development_dependency('fakeweb') + s.add_development_dependency('geminabox') end
Add geminabox as a dev dependency
diff --git a/lib/gitlab/satellite/files/file_action.rb b/lib/gitlab/satellite/files/file_action.rb index abc1234..def5678 100644 --- a/lib/gitlab/satellite/files/file_action.rb +++ b/lib/gitlab/satellite/files/file_action.rb @@ -4,7 +4,7 @@ attr_accessor :file_path, :ref def initialize(user, project, ref, file_path) - super user, project, git_timeout: 10.seconds + super user, project @file_path = file_path @ref = ref end
Use same 30 seconds satellite timeout for all actions Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
diff --git a/lib/riddle/0.9.9/configuration/searchd.rb b/lib/riddle/0.9.9/configuration/searchd.rb index abc1234..def5678 100644 --- a/lib/riddle/0.9.9/configuration/searchd.rb +++ b/lib/riddle/0.9.9/configuration/searchd.rb @@ -1,6 +1,8 @@ module Riddle class Configuration class Searchd + NUMBER = 1.class + def valid? set_listen @@ -10,14 +12,14 @@ private def set_listen - @listen = @listen.to_s if @listen.is_a?(Fixnum) + @listen = @listen.to_s if @listen.is_a?(NUMBER) return unless @listen.nil? || @listen.empty? @listen = [] @listen << @port.to_s if @port @listen << "9306:mysql41" if @mysql41.is_a?(TrueClass) - @listen << "#{@mysql41}:mysql41" if @mysql41.is_a?(Fixnum) + @listen << "#{@mysql41}:mysql41" if @mysql41.is_a?(NUMBER) @listen.each { |l| l.insert(0, "#{@address}:") } if @address end
Check for numbers in a MRI 2.4 friendly manner.
diff --git a/buildr-ipojo.gemspec b/buildr-ipojo.gemspec index abc1234..def5678 100644 --- a/buildr-ipojo.gemspec +++ b/buildr-ipojo.gemspec @@ -0,0 +1,25 @@+require File.expand_path(File.dirname(__FILE__) + '/lib/buildr/ipojo/version') + +Gem::Specification.new do |spec| + spec.name = 'buildr-ipojo' + spec.version = Buildr::Ipojo::Version::STRING + spec.authors = ['Peter Donald'] + spec.email = ["peter@realityforge.org"] + spec.homepage = "http://github.com/realityforge/buildr-ipojo" + spec.summary = "Buildr tasks to process OSGi bundles using IPojo" + spec.description = <<-TEXT +This is a buildr extension that processes OSGi bundles using the +iPojo "pojoization" tool that generates appropriate metadata from +annotations and a config file. + TEXT + + spec.files = Dir['{lib,spec}/**/*', '*.gemspec'] + + ['LICENSE', 'README.rdoc', 'CHANGELOG', 'Rakefile'] + spec.require_paths = ['lib'] + + spec.has_rdoc = true + spec.extra_rdoc_files = 'README.rdoc', 'LICENSE', 'CHANGELOG' + spec.rdoc_options = '--title', "#{spec.name} #{spec.version}", '--main', 'README.rdoc' + + spec.post_install_message = "Thanks for installing the iPojo extension for Buildr" +end
Add in the initial gemspec for the project
diff --git a/lib/dimples/configuration.rb b/lib/dimples/configuration.rb index abc1234..def5678 100644 --- a/lib/dimples/configuration.rb +++ b/lib/dimples/configuration.rb @@ -20,6 +20,7 @@ { output: './public', archives: 'archives', + paginated_posts: 'posts', posts: 'archives/%Y/%m/%d', categories: 'archives/categories' } @@ -27,6 +28,7 @@ def self.default_generation { + paginated_posts: true, archives: true, year_archives: true, month_archives: true, @@ -41,6 +43,7 @@ { post: 'post', category: 'category', + paginated_post: 'paginated_post', archive: 'archive', date_archive: 'archive' }
Add default paginated post settings
diff --git a/capistrano-fast_deploy.gemspec b/capistrano-fast_deploy.gemspec index abc1234..def5678 100644 --- a/capistrano-fast_deploy.gemspec +++ b/capistrano-fast_deploy.gemspec @@ -8,12 +8,15 @@ gem.version = Capistrano::FastDeploy::VERSION gem.authors = ["Aaron Jensen"] gem.email = ["aaronjensen@gmail.com"] - gem.description = %q{TODO: Write a gem description} - gem.summary = %q{TODO: Write a gem summary} + + gem.summary = %q{Enable git style deploys in capistrano} + gem.description = %q{A couple Capistrano tweaks to speed up deploys using git style deploys and a few optimizations} gem.homepage = "" gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] + + gem.add_runtime_dependency "capistrano", "~>2.13" end
Add summary and description and dependency
diff --git a/app/lib/services.rb b/app/lib/services.rb index abc1234..def5678 100644 --- a/app/lib/services.rb +++ b/app/lib/services.rb @@ -19,7 +19,8 @@ def self.email_alert_api @email_alert_api ||= GdsApi::EmailAlertApi.new( - Plek.find("email-alert-api") + Plek.find("email-alert-api"), + bearer_token: ENV.fetch("EMAIL_ALERT_API_BEARER_TOKEN", "wubbalubbadubdub") ) end end
Configure email-alert-api with bearer token Also moves the creation of the client into the `Services` module.
diff --git a/test/run_test.rb b/test/run_test.rb index abc1234..def5678 100644 --- a/test/run_test.rb +++ b/test/run_test.rb @@ -5,7 +5,7 @@ test_dir = File.join(base_dir, 'test') require 'test-unit' -require 'test/unit/notify' +require 'test/unit/notify' unless ENV['DISABLE_TEST_NOTIFY'] require 'idcf/cli/validate/custom/init' $LOAD_PATH.unshift(test_dir)
Add test option to disable notifications
diff --git a/SwiftyUserDefaults.podspec b/SwiftyUserDefaults.podspec index abc1234..def5678 100644 --- a/SwiftyUserDefaults.podspec +++ b/SwiftyUserDefaults.podspec @@ -11,6 +11,7 @@ s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.9' s.tvos.deployment_target = '9.0' + s.watchos.deployment_target = '2.0' s.source_files = 'SwiftyUserDefaults/*.swift' end
Add watchOS support to the podspec
diff --git a/lib/necromancer/converter.rb b/lib/necromancer/converter.rb index abc1234..def5678 100644 --- a/lib/necromancer/converter.rb +++ b/lib/necromancer/converter.rb @@ -28,6 +28,17 @@ end.new end + # Fail with conversion type error + # + # @param [Object] value + # the value that cannot be converted + # + # @api private + def fail_conversion_type(value) + fail ConversionTypeError, "#{value} could not be converted " \ + "from `#{source}` into `#{target}`" + end + attr_accessor :source attr_accessor :target
Add common type conversion error method.
diff --git a/lib/puppet/util/cli_parser.rb b/lib/puppet/util/cli_parser.rb index abc1234..def5678 100644 --- a/lib/puppet/util/cli_parser.rb +++ b/lib/puppet/util/cli_parser.rb @@ -23,7 +23,11 @@ end def parse(parser, input) - result = parser.parse input + begin + result = parser.parse input + rescue Exception => e + raise "Error parsing path, #{e}: #{input}" + end raise "#{parser.failure_reason}: #{input}" if !result result.value end
Add better contect for parsing errors
diff --git a/lib/tasks/publishing_api.rake b/lib/tasks/publishing_api.rake index abc1234..def5678 100644 --- a/lib/tasks/publishing_api.rake +++ b/lib/tasks/publishing_api.rake @@ -2,9 +2,6 @@ desc "Send all tags to the publishing-api, skipping any marked as dirty" task :republish_all_tags => :environment do - - CollectionsPublisher.services(:publishing_api).put_content_item("/browse", RootBrowsePagePresenter.new.render_for_publishing_api) - puts "Sending #{Tag.count} tags to the publishing-api" done = 0 Tag.find_each do |tag| @@ -19,6 +16,11 @@ puts "#{done} completed..." end end - puts "All done, #{done} tags sent to publishing-api." + puts "Done: #{done} tags sent to publishing-api." + + puts "Sending root browse page to publishing-api" + CollectionsPublisher.services(:publishing_api).put_content_item("/browse", RootBrowsePagePresenter.new.render_for_publishing_api) + + puts "All done" end end
Send root browse page after other tags. To prevent a race condition when initially deploying this where the /browse page is set to an exact route before the *.josn browse routes are registered.
diff --git a/Transition.podspec b/Transition.podspec index abc1234..def5678 100644 --- a/Transition.podspec +++ b/Transition.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Transition' - s.version = '1.0.0' + s.version = '1.0.1' s.summary = 'Easy interactive interruptible custom ViewController transitions.' s.description = <<-DESC
Bump pod spec version to 1.0.1
diff --git a/Casks/julia.rb b/Casks/julia.rb index abc1234..def5678 100644 --- a/Casks/julia.rb +++ b/Casks/julia.rb @@ -7,6 +7,7 @@ license :mit app "Julia-#{version}.app" + binary "Julia-#{version}.app/Contents/Resources/julia/bin/julia" zap :delete => '~/.julia' end
Add binary stanza to Julia cask
diff --git a/test/good_migrations_test.rb b/test/good_migrations_test.rb index abc1234..def5678 100644 --- a/test/good_migrations_test.rb +++ b/test/good_migrations_test.rb @@ -15,13 +15,13 @@ def test_good_migration_does_not_blow_up stdout, stderr, status = shell("bundle exec rake db:drop db:create db:migrate VERSION=20160202163803") - assert_equal 0, status + assert_equal 0, status.exitstatus end def test_rake_full_migrate_blows_up stdout, stderr, status = shell("bundle exec rake db:drop db:create db:migrate") - refute_equal 0, status + refute_equal 0, status.exitstatus assert_match /GoodMigrations::LoadError: Rails attempted to auto-load:/, stderr assert_match /example\/app\/models\/pant.rb/, stderr end @@ -29,7 +29,7 @@ def test_env_flag_prevents_explosion stdout, stderr, status = shell("GOOD_MIGRATIONS=skip bundle exec rake db:drop db:create db:migrate") - assert_equal 0, status + assert_equal 0, status.exitstatus end private @@ -41,6 +41,8 @@ bundle install #{command} SCRIPT - Open3.capture3(script, :chdir => "example") + Bundler.with_clean_env do + Open3.capture3(script, :chdir => "example") + end end end
Use clean Bundle env, status.exitstatus (fix travis) * Process status objects are weird. They'll be integers on success (ie: 0) ,but objects on a failure. Using status.exitstatus means we always get an integer for comparison * Use Bundler.with_clean_env to shell out. Apparently environment variables become a complete mess when a bundler process shells out to another bundler process. `.with_clean_env` is the sanctioned work-around. (this should fix Travis)
diff --git a/Stripe.podspec b/Stripe.podspec index abc1234..def5678 100644 --- a/Stripe.podspec +++ b/Stripe.podspec @@ -13,6 +13,6 @@ s.requires_arc = true s.ios.deployment_target = '5.0' - s.dependency 'PaymentKit' , '~> 1.0.4' + s.dependency 'PaymentKit', :git => 'https://github.com/oanaBan/PaymentKit', :commit => '7f0e590c60df84e78da85ff7c283f4e9a72dbf01' -end +end
Add Zip Code - UI
diff --git a/lib/shard_handler/handler.rb b/lib/shard_handler/handler.rb index abc1234..def5678 100644 --- a/lib/shard_handler/handler.rb +++ b/lib/shard_handler/handler.rb @@ -4,6 +4,7 @@ # {Handler}. # # @see Model + # @api private class Handler # @param klass [ActiveRecord::Base] model class # @param configs [Hash] a hash with database connection settings @@ -32,6 +33,7 @@ # name. # # @param name [Symbol, String] shard name + # @return [ActiveRecord::ConnectionAdapters::ConnectionHandler] def connection_handler_for(name) return if name.nil? @cache.fetch(name.to_sym) do
Add more documentation for Handler
diff --git a/app/helpers/content_manager/application_helper.rb b/app/helpers/content_manager/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/content_manager/application_helper.rb +++ b/app/helpers/content_manager/application_helper.rb @@ -2,7 +2,6 @@ module ApplicationHelper # a helper to automatically figure out where to get you're content from def cm(key) - puts "Searching for key: #{key}" content_instance.public_send(key.to_sym) end @@ -16,7 +15,7 @@ # TODO: This is hard, even rails does it wrong, need a better solution def content_class # ensure constant is loaded - if Object.const_defined?(constant_name) + if Object.const_defined?(constant_name.classify) constant_name.classify.constantize elsif file_path = constant_file_path # This will not load class in module properly
Fix error in Heroku fix Passing ill formatted constant names to Object.const_defined?
diff --git a/app/models/manageiq/providers/ansible_tower/inventory/persister/automation_manager.rb b/app/models/manageiq/providers/ansible_tower/inventory/persister/automation_manager.rb index abc1234..def5678 100644 --- a/app/models/manageiq/providers/ansible_tower/inventory/persister/automation_manager.rb +++ b/app/models/manageiq/providers/ansible_tower/inventory/persister/automation_manager.rb @@ -15,5 +15,12 @@ %i(credentials), :builder_params => {:resource => manager} ) + + collections[:vms] = ::ManagerRefresh::InventoryCollection.new( + :model_class => Vm, + :arel => Vm, + :strategy => :local_db_find_references, + :manager_ref => [:uid_ems] + ) end end
Add an InventoryCollection for VMs crosslinks Add an InventoryCollection for VMs crosslinks
diff --git a/app/queries/raw_time_query.rb b/app/queries/raw_time_query.rb index abc1234..def5678 100644 --- a/app/queries/raw_time_query.rb +++ b/app/queries/raw_time_query.rb @@ -11,7 +11,7 @@ INNER JOIN existing_scope ON existing_scope.id = raw_times.id) SELECT - r.id, r.event_group_id, r.parameterized_split_name, r.bib_number + r.* , e.id AS effort_id , e.event_id , s.split_id
Fix RawTimeQuery.with_relations to return all RawTime attributes.
diff --git a/spec/js_bundle_spec.lint.rb b/spec/js_bundle_spec.lint.rb index abc1234..def5678 100644 --- a/spec/js_bundle_spec.lint.rb +++ b/spec/js_bundle_spec.lint.rb @@ -0,0 +1,16 @@+require "open3" + +RSpec.describe "JS bundle sanity" do + it "is up to date" do + current_bundle = File.read("app/assets/javascripts/active_admin/base.js") + + output, status = Open3.capture2e("yarn build -o tmp/bundle.js") + expect(status).to be_success, output + + new_bundle = File.read("tmp/bundle.js") + + msg = "Javascript bundle is out of date. Please run `yarn build` and commit changes." + + expect(current_bundle).to eq(new_bundle), msg + end +end
Add javascript bundle checking to specs
diff --git a/lib/sprinkle/deployment.rb b/lib/sprinkle/deployment.rb index abc1234..def5678 100644 --- a/lib/sprinkle/deployment.rb +++ b/lib/sprinkle/deployment.rb @@ -17,9 +17,11 @@ @style = Actors.const_get(type.to_s.titleize).new &block end - def source(&block) - @defaults[:source] = block + def method_missing(sym, *args, &block) + @defaults[sym] = block end + + def respond_to?(sym); !!@defaults[sym]; end def process POLICIES.each do |policy|
Support any installer type defaults via method missing
diff --git a/config/initializers/gds-sso.rb b/config/initializers/gds-sso.rb index abc1234..def5678 100644 --- a/config/initializers/gds-sso.rb +++ b/config/initializers/gds-sso.rb @@ -1,7 +1,7 @@ GDS::SSO.config do |config| - config.user_model = "User" - config.oauth_id = ENV['PANOPTICON_OAUTH_ID'] || "abcdefgh12345678pan" - config.oauth_secret = ENV['PANOPTICON_OAUTH_SECRET'] || "secret" + config.user_model = "User" + config.oauth_id = ENV['OAUTH_ID'] + config.oauth_secret = ENV['OAUTH_SECRET'] config.oauth_root_url = Plek.current.find("signon") end
Use correct oauth environment variables These are now set in hieradata. Trello: https://trello.com/c/LZBdyczv
diff --git a/lib/zipline/output_stream.rb b/lib/zipline/output_stream.rb index abc1234..def5678 100644 --- a/lib/zipline/output_stream.rb +++ b/lib/zipline/output_stream.rb @@ -17,12 +17,16 @@ def put_next_entry(entry_name, size) new_entry = Zip::Entry.new(@file_name, entry_name) - new_entry.size = size #THIS IS THE MAGIC, tells zip to look after data for size, crc new_entry.gp_flags = new_entry.gp_flags | 0x0008 super(new_entry) + + # Uncompressed size in the local file header must be zero when bit 3 + # of the general purpose flags is set, so set the size after the header + # has been written. + new_entry.size = size end # just reset state, no rewinding required
Set uncompressed size in local file header to 0 The ZIP spec [1] describes in section 4.4.9 that the uncompressed size field is set to zero in the local file header if bit 3 of the general purpose flags is set, which zipline does. Some applications actually care about this, e.g. Powerpoint regards a file as corrupt when the uncompressed size and bit 3 are set. [1] https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
diff --git a/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb b/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb index abc1234..def5678 100644 --- a/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb +++ b/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb @@ -37,15 +37,26 @@ def extract_relation_clause_from(relation, name) case name - when :conditions then relation.where_values_hash - when :order then relation.order_values.join(', ') - else raise ArgumentError, "Unknown clause '#{name}'" + when :conditions + relation.where_values_hash + when :order + relation.order_values.map { |value| value_as_sql(value) }.join(', ') + else + raise ArgumentError, "Unknown clause '#{name}'" end end private attr_reader :subject, :name + + def value_as_sql(value) + if value.respond_to?(:to_sql) + value.to_sql + else + value + end + end end end end
Make `order` option Rails 4.0.1-compatible The way that we figure out whether the value which is passed to `order` is the same as the `order` that the association was defined with is by creating an ActiveRecord::Relation object from the given `order` and comparing it with the Relation stored under the association. Specifically, every time you call `order` on a Relation, it appends the value you've given to an internal `order_values` array, so we actually access this array and compare the two between the two Relation objects. Currently we assume that this `order_values` array is an array of strings, so it's very easy to compare. That was valid pre-Rails 4.0.1, but it looks like as per [these][1] [commits][2], it's now possible for `order_values` to be an array of Arel nodes. So, to make a proper comparison, we have to convert any Arel nodes to strings by calling #to_sql on them. [1]: https://github.com/rails/rails/commit/d345ed4 [2]: https://github.com/rails/rails/commit/f83c9b10b4c92b0d8deacb30d6fdfa2b1252d6dd
diff --git a/lib/vagrant-free-memory.rb b/lib/vagrant-free-memory.rb index abc1234..def5678 100644 --- a/lib/vagrant-free-memory.rb +++ b/lib/vagrant-free-memory.rb @@ -1,9 +1,13 @@-require "vagrant/free/memory/version" +require 'vagrant-free-memory/version' -module Vagrant - module Free - module Memory - # Your code goes here... - end +begin + require 'vagrant' +rescue LoadError + raise 'This plugin must run within Vagrant.' +end + +module VagrantFreeMemory + class Plugin < Vagrant.plugin('2') + name 'vagrant-free-memory' end end
Create the module for the plugin
diff --git a/lib/whereabouts_methods.rb b/lib/whereabouts_methods.rb index abc1234..def5678 100644 --- a/lib/whereabouts_methods.rb +++ b/lib/whereabouts_methods.rb @@ -13,6 +13,7 @@ module ClassMethods def has_whereabouts has_one :address, :as => :addressable, :dependent => :destroy + accepts_nested_attributes_for :address extend Yrgoldteeth::Has::Whereabouts::SingletonMethods end end
Add accepts_nested_attributes_for address on has_whereabouts class methods
diff --git a/app/views/renalware/api/ukrdc/patients/_hd_session_observations.xml.builder b/app/views/renalware/api/ukrdc/patients/_hd_session_observations.xml.builder index abc1234..def5678 100644 --- a/app/views/renalware/api/ukrdc/patients/_hd_session_observations.xml.builder +++ b/app/views/renalware/api/ukrdc/patients/_hd_session_observations.xml.builder @@ -17,14 +17,6 @@ "weight" => observations.weight } - if observations.temperature_measured == :yes - measurements["temperature"] = observations.temperature - end - - if observations.respiratory_rate_measured == :yes - measurements["respiratory_rate"] = observations.respiratory_rate - end - measurements.each do |i18n_key, value| xml.Observation do xml.ObservationTime observation_times[pre_post].iso8601
Remove temperature and respiratory_rate HD observations
diff --git a/lib/berufsorientierungstag.rb b/lib/berufsorientierungstag.rb index abc1234..def5678 100644 --- a/lib/berufsorientierungstag.rb +++ b/lib/berufsorientierungstag.rb @@ -16,13 +16,16 @@ @repo = SpielElementRepository.new @repo.import_map('maps/test.json') @repo.game_objects << @spieler = Spieler.new(1, 1, repo: @repo) - @repo.export_map('maps/') + # @repo.export_map('maps/') + end + + def needs_cursor? + @edit_mode end def update @spieler.call unless @edit_mode @edit_mode = !@edit_mode if Gosu.button_down?(Gosu::KbE) - puts @edit_mode.inspect @repo.edit_mouse_click(mouse_x, mouse_y) \ if @edit_mode && Gosu.button_down?(Gosu::MsLeft) end
Add Cursor to Edit Mode + Minor Tweaks -remove debug output
diff --git a/config/initializers/geocoder.rb b/config/initializers/geocoder.rb index abc1234..def5678 100644 --- a/config/initializers/geocoder.rb +++ b/config/initializers/geocoder.rb @@ -10,8 +10,9 @@ Geocoder.configure( lookup: :google, + api_key: ENV['GOOGLE_GEOCODING_API_KEY'], + use_https: true, cache: cache, - http_proxy: ENV['QUOTAGUARD_URL'], always_raise: [ Geocoder::OverQueryLimitError, Geocoder::RequestDenied,
Use API key for Google geocoding **Why**: To prevent going over the quota.
diff --git a/lib/metacrunch/ubpb/transformations/primo_to_elasticsearch/add_record_date_facet.rb b/lib/metacrunch/ubpb/transformations/primo_to_elasticsearch/add_record_date_facet.rb index abc1234..def5678 100644 --- a/lib/metacrunch/ubpb/transformations/primo_to_elasticsearch/add_record_date_facet.rb +++ b/lib/metacrunch/ubpb/transformations/primo_to_elasticsearch/add_record_date_facet.rb @@ -5,8 +5,11 @@ class Metacrunch::UBPB::Transformations::PrimoToElasticsearch::AddCatalogingDate < Metacrunch::Transformator::Transformation::Step def call if (last_creation_date = [source["creation_date"]].flatten.compact.last) - if cataloging_date = Date.strptime(last_creation_date, "%Y%m%d").iso8601 rescue ArgumentError - target["cataloging_date"] = cataloging_date + begin + if cataloging_date = Date.strptime(last_creation_date, "%Y%m%d").iso8601 + target["cataloging_date"] = cataloging_date + end + rescue ArgumentError end end end
Fix error handling for cataloging_date
diff --git a/merb-haml/lib/merb-haml.rb b/merb-haml/lib/merb-haml.rb index abc1234..def5678 100644 --- a/merb-haml/lib/merb-haml.rb +++ b/merb-haml/lib/merb-haml.rb @@ -7,4 +7,11 @@ Merb::BootLoader.after_app_loads do require "sass/plugin" if File.directory?(Merb.dir_for(:stylesheet) / "sass") end + + # Hack because Haml uses symbolize_keys + class Hash + def symbolize_keys! + self + end + end end
Make symbolize_keys! a noop temporarily.
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index abc1234..def5678 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -10,4 +10,3 @@ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. Rails.application.config.assets.precompile = [ Proc.new{ |path| !File.extname(path).in?(['.html', '.htm']) } ] Rails.application.config.assets.paths.unshift Rails.root.join("app", "assets").to_s -Rails.application.config.assets.precompile += %w( ckeditor/* )
Remove ckeditor from initialize file. :fries:
diff --git a/data-aggregation-index.gemspec b/data-aggregation-index.gemspec index abc1234..def5678 100644 --- a/data-aggregation-index.gemspec +++ b/data-aggregation-index.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'data_aggregation-index' - s.version = '0.1.0.0' + s.version = '0.2.0.0' s.summary = 'Event store data aggregation index library' s.description = ' '
Package version is increased from 0.1.0.0 to 0.2.0.0
diff --git a/db/migrate/20161023011514_add_pickup_date_and_pickup_time_to_orders.rb b/db/migrate/20161023011514_add_pickup_date_and_pickup_time_to_orders.rb index abc1234..def5678 100644 --- a/db/migrate/20161023011514_add_pickup_date_and_pickup_time_to_orders.rb +++ b/db/migrate/20161023011514_add_pickup_date_and_pickup_time_to_orders.rb @@ -0,0 +1,8 @@+class AddPickupDateAndPickupTimeToOrders < ActiveRecord::Migration[5.0] + def change + add_column :orders, :pickup_date, :date + add_column :orders, :pickup_time, :string + + add_index :orders, :pickup_date + end +end
Add pickup date and pickup time columns to orders
diff --git a/Casks/a-better-finder-rename-beta.rb b/Casks/a-better-finder-rename-beta.rb index abc1234..def5678 100644 --- a/Casks/a-better-finder-rename-beta.rb +++ b/Casks/a-better-finder-rename-beta.rb @@ -1,6 +1,6 @@ cask :v1 => 'a-better-finder-rename-beta' do version '10' - sha256 'df4208eb01c25434b5c93c65ae82c12b2bab893a63d5c286f8c89cf4ae7b7137' + sha256 '7a103b11efbd649f646fe93435cb07b6bc9b93024c177921109e327960566fda' url "http://www.publicspace.net/download/ABFRX#{version}.dmg" name 'A Better Finder Rename'
Update SHA256 for A Better Finder Rename 10
diff --git a/week-5/calculate-mode/my_solution.rb b/week-5/calculate-mode/my_solution.rb index abc1234..def5678 100644 --- a/week-5/calculate-mode/my_solution.rb +++ b/week-5/calculate-mode/my_solution.rb @@ -1,7 +1,7 @@ =begin # Calculate the mode Pairing Challenge -# I worked on this challenge [by myself, with: ] +# I worked on this challenge [with: Alan Alcesto] # I spent [] hours on this challenge. @@ -27,29 +27,9 @@ # 1. Initial Solution =end +def mode(array) -def mode(array) - histogram = Hash.new - - array.each do |item| - histogram[item] = 0 - end - - array.each do |item| - histogram[item] += 1 - end - - histogram.each do |key, val| - puts "#{key}:#{val}" - end - - - #NOW I WANT TO MOVE THE KEY(S) WITH THE HIGHEST VALUE(S) INTO AN ARRAY - #THEN I WANT TO RETURN THAT ARRAY end - -# mode([1,2,3,3,-2,"cat", "dog", "cat"]) -mode(["who", "what", "where", "who"]) # 3. Refactored Solution
Add my initial pseudocode for 5.3
diff --git a/lib/gemstash/configuration.rb b/lib/gemstash/configuration.rb index abc1234..def5678 100644 --- a/lib/gemstash/configuration.rb +++ b/lib/gemstash/configuration.rb @@ -1,4 +1,5 @@ require "yaml" +require "erb" module Gemstash #:nodoc: @@ -31,7 +32,7 @@ file ||= DEFAULT_FILE if File.exist?(file) - @config = YAML.load_file(file) + @config = YAML.load(::ERB.new(File.read(file)).result) @config = DEFAULTS.merge(@config) @config.freeze else
Support ERB parsing in YAML config
diff --git a/lib/intercom-rails/railtie.rb b/lib/intercom-rails/railtie.rb index abc1234..def5678 100644 --- a/lib/intercom-rails/railtie.rb +++ b/lib/intercom-rails/railtie.rb @@ -1,13 +1,18 @@ module IntercomRails class Railtie < Rails::Railtie initializer "intercom-rails" do |app| - ActionView::Base.send :include, ScriptTagHelper - ActionController::Base.send :include, CustomDataHelper - ActionController::Base.send :include, AutoInclude::Method - if ActionController::Base.respond_to? :after_action - ActionController::Base.after_action :intercom_rails_auto_include - else - ActionController::Base.after_filter :intercom_rails_auto_include + ActiveSupport.on_load :action_view do + include ScriptTagHelper + end + ActiveSupport.on_load :action_controller do + include CustomDataHelper + include AutoInclude::Method + + if respond_to? :after_action + after_action :intercom_rails_auto_include + else + after_filter :intercom_rails_auto_include + end end end end
Make use of ActiveSupport lazy loading this to prevent load order issues. More on lazy loading here: https://simonecarletti.com/blog/2011/04/understanding-ruby-and-rails-lazy-load-hooks/
diff --git a/promo/app/models/spree/order_decorator.rb b/promo/app/models/spree/order_decorator.rb index abc1234..def5678 100644 --- a/promo/app/models/spree/order_decorator.rb +++ b/promo/app/models/spree/order_decorator.rb @@ -20,7 +20,8 @@ most_valuable_adjustment = adjustments.promotion.eligible.max{|a,b| a.amount.abs <=> b.amount.abs} current_adjustments = (adjustments.promotion.eligible - [most_valuable_adjustment]) current_adjustments.each do |adjustment| - unless adjustment.originator.calculator.is_a?(Spree::Calculator::PerItem) + calculator = adjustment.originator.try(:calculator) + if calculator && !calculator.is_a?(Spree::Calculator::PerItem) adjustment.update_attribute_without_callbacks(:eligible, false) end end
[promo] Check for calculator on adjustment.originator in update_adjustments_with_promotion_listing before checking its type Related up to #1526
diff --git a/lib/orchestrate.io/request.rb b/lib/orchestrate.io/request.rb index abc1234..def5678 100644 --- a/lib/orchestrate.io/request.rb +++ b/lib/orchestrate.io/request.rb @@ -36,6 +36,7 @@ end end } + options.delete_if {|k,v| v.empty? if v.is_a? Hash } end def method_missing(method, *args, &block)
Delete the key if its value is an empty hash
diff --git a/brew/cask/awsaml.rb b/brew/cask/awsaml.rb index abc1234..def5678 100644 --- a/brew/cask/awsaml.rb +++ b/brew/cask/awsaml.rb @@ -7,7 +7,6 @@ checkpoint: '3d2a662d80c619406bac6682158d8b89320b9d5359863cfbeddd574b00019e9a' name 'awsaml' homepage 'https://github.com/rapid7/awsaml' - license :mit app 'Awsaml.app' end
Remove the "license" stanza as it's no longer supported. See the complete list of stanzas that are valid in homebrew-cask. https://github.com/caskroom/homebrew-cask/blob/master/doc/cask_language_reference/all_stanzas.md
diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -1,5 +1,5 @@ class UserMailer < ActionMailer::Base - default from: "emmaleth2003@devbootcamp.com" + default from: "wine-tasting@devbootcamp.com" def welcome_email(user) @user = user
Change 'from' email for mailers
diff --git a/lib/geocaching.rb b/lib/geocaching.rb index abc1234..def5678 100644 --- a/lib/geocaching.rb +++ b/lib/geocaching.rb @@ -1,4 +1,7 @@ require "geocaching/version" +require "core_ext/array" +require "core_ext/integer" +require "core_ext/string" module Geocaching # Your code goes here...
Add requires for core extensions
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -23,25 +23,5 @@ photos << in_db.select {|x| !in_queue.include?(x.id)} end - - # existing_photos = Photo.where(unsplash_id: unsplash_ids) - # existing_queues = PhotoQueue. - # includes(:photos). - # where(photo_id: existing_photos) - - # photos_to_add.each do |photo| - # photos.find_or_create_by(unsplash_id: photo[:unsplash_id]) do |x| - # x.width = photo[:width] - # x.height = photo[:height] - # x.photographer_name = photo[:photographer_name] - # x.photographer_link = photo[:photographer_link] - # x.raw_url = photo[:raw_url] - # x.full_url = photo[:full_url] - # x.regular_url = photo[:regular_url] - # x.small_url = photo[:small_url] - # x.thumb_url = photo[:thumb_url] - # x.link = photo[:link] - # end - # end end end
Remove unused code in User model
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -5,9 +5,10 @@ # :rememberable, :trackable, :validatable and :omniauthable devise :registerable, :trackable + field :name field :contact, :type => Boolean - validates_presence_of :email, :contact - # validates_uniqueness_of :email, :case_sensitive => false - attr_accessible :email, :contact + validates_presence_of :email, :contact, :name + validates_uniqueness_of :email, :case_sensitive => false + attr_accessible :name, :email, :contact end
Add name to User model.
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -6,7 +6,7 @@ named_scope :active, :conditions => {:active => true} def can_second?(star) - return false if [star.from, star.to.flatten].include?(self) + return false if [star.from, star.to].flatten.include?(self) return false if seconded?(star) return true end
Fix for seconding bug for multi-recipient starz
diff --git a/app/models/user.rb b/app/models/user.rb index abc1234..def5678 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -19,16 +19,4 @@ def gds_editor? permissions.include?('gds_editor') end - - def organisation_content_id - organisation_content_id = super - - if organisation_content_id.present? - organisation_content_id - else - { - "rail-accident-investigation-branch" => "013872d8-8bbb-4e80-9b79-45c7c5cf9177", - }[organisation_slug] - end - end end
Revert "Hotfix: Fix RAIB permissions" The organisation_content_id field now gets set by SPv1 as per this commit: https://github.com/alphagov/specialist-publisher/pull/732/commits/75dc26807c0662a9a8c0fe76f8bb682db04dd1e2 The next time a user logs in through signon, that field is set and this application's permissions can leverage it for checking permissions.
diff --git a/lib/plugins/wa.rb b/lib/plugins/wa.rb index abc1234..def5678 100644 --- a/lib/plugins/wa.rb +++ b/lib/plugins/wa.rb @@ -11,12 +11,12 @@ input_array = text.split(/[[:space:]]/) input = input_array.join(' ').downcase response = Nokogiri::XML(open("http://api.wolframalpha.com/v2/query?input=#{URI.encode(input)}&appid=#{ENV['WA_ID']}")) - interp = response.xpath('//plaintext').children[0].text + interp = response.xpath('//plaintext').children[0].text.split(/[[:space:]]/).join(' ') if interp.size > 75 interp.slice! 75..-1 interp += "..." end - result = response.xpath('//plaintext').children[1].text + result = response.xpath('//plaintext').children[1].text.split(/[[:space:]]/).join(' ') if result.size > 75 result.slice! 75..-1 result += "..."
Check for and delete nbsp characters
diff --git a/app/uploaders/basic_uploader.rb b/app/uploaders/basic_uploader.rb index abc1234..def5678 100644 --- a/app/uploaders/basic_uploader.rb +++ b/app/uploaders/basic_uploader.rb @@ -13,7 +13,8 @@ # Override the directory where uploaded files will be stored. # This is a sensible default for uploaders that are meant to be mounted: def store_dir - "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" + prefix = Rails.env.test? ? '../tmp/' : '' + prefix + "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end # Provide a default URL as a default if there hasn't been a file uploaded:
Store files in tmp in specs
diff --git a/spec/integration/run_sim_spec.rb b/spec/integration/run_sim_spec.rb index abc1234..def5678 100644 --- a/spec/integration/run_sim_spec.rb +++ b/spec/integration/run_sim_spec.rb @@ -16,11 +16,9 @@ :sim_control => sim_control } - hash = nil - Retriable.retriable({:tries => Resources.shared.launch_retries}) do - hash = RunLoop.run(options) + Resources.shared.launch_sim_with_options(options) do |hash| + expect(hash).not_to be nil end - expect(hash).not_to be nil end xcode_installs = Resources.shared.alt_xcode_install_paths @@ -38,11 +36,10 @@ :sim_control => sim_control } - hash = nil - Retriable.retriable({:tries => Resources.shared.launch_retries}) do - hash = RunLoop.run(options) + Resources.shared.launch_sim_with_options(options) do |hash| + expect(hash).not_to be nil end - expect(hash).not_to be nil + end end end
Use launch-sim interface in run sim specs
diff --git a/spec/lib/import_finisher_spec.rb b/spec/lib/import_finisher_spec.rb index abc1234..def5678 100644 --- a/spec/lib/import_finisher_spec.rb +++ b/spec/lib/import_finisher_spec.rb @@ -15,5 +15,30 @@ require 'spec_helper' describe ImportFinisher do + describe "#on_success" do + before :each do + @project = FactoryGirl.create(:project, :light) + @commit = FactoryGirl.create(:commit, project: @project, loading: true) + @key = FactoryGirl.create(:key, project: @project) + @commit.keys << @key + @translation = FactoryGirl.create(:translation, key: @key, copy: "test") + end + it "sets loading to false and sets ready to true if all translations are finished" do + @translation.update! source_copy: "test", approved: true, skip_readiness_hooks: true + expect(@commit.reload).to be_loading + expect(@commit).to_not be_ready + ImportFinisher.new.on_success true, 'commit_id' => @commit.id + expect(@commit.reload).to_not be_loading + expect(@commit).to be_ready + end + + it "sets loading to false and sets ready to false if some translations are not translated" do + expect(@commit.reload).to be_loading + expect(@commit).to_not be_ready + ImportFinisher.new.on_success true, 'commit_id' => @commit.id + expect(@commit.reload).to_not be_loading + expect(@commit).to_not be_ready + end + end end
Add specs for import finisher
diff --git a/spec/support/factories/topics.rb b/spec/support/factories/topics.rb index abc1234..def5678 100644 --- a/spec/support/factories/topics.rb +++ b/spec/support/factories/topics.rb @@ -3,7 +3,7 @@ t.subject "FIRST TOPIC" t.forum {|f| f.association(:forum) } t.user {|u| u.association(:user) } - t.posts { |p| [p.association(:post)]} + t.posts_attributes { [Factory.attributes_for(:post)] } trait :approved do after_create { |topic| topic.approve! }
Send through post attributes using posts_attributes when creating a topic This ensures that when we use factories that the topics+posts are created identically to how they're created inside the application
diff --git a/spec/unit/oss_compliance_spec.rb b/spec/unit/oss_compliance_spec.rb index abc1234..def5678 100644 --- a/spec/unit/oss_compliance_spec.rb +++ b/spec/unit/oss_compliance_spec.rb @@ -0,0 +1,52 @@+require 'spec_helper' +require 'rubygems/package' +require 'zlib' +require 'yaml' +require 'httparty' + +describe 'OSS Compliance' do + + describe 'Erlang blob compliance' do + + blob_path = "" + + before :all do + blob_path = fetch_blob("erlang\/otp") + end + + it 'should not contain proper/proper_common.hrl' do + expect(blob_contains(blob_path, "proper\/proper_common.hrl")).to be(false) + end + + it 'should not contain ewgi/ewgi.hrl' do + expect(blob_contains(blob_path, "ewgi\/ewgi.hrl")).to be(false) + end + + it 'should not contain ewgi2/ewgi.hrl' do + expect(blob_contains(blob_path, "ewgi2\/ewgi.hrl")).to be(false) + end + end +end + +def download_from_blob_bucket(blob_object_id, local_destination) + bucket_address ="https://s3.amazonaws.com/rabbitmq-bosh-release-blobs" + File.open("#{local_destination}", "wb") do |f| + f.write HTTParty.get("#{bucket_address}/#{blob_object_id}").parsed_response + end +end + +def fetch_blob(blob_prefix) + blobs = YAML.load_file('config/blobs.yml') + blob_properties = blobs.detect{ |key,val| /#{blob_prefix}/.match(key) }[1] + + local_destination = "/tmp/erlang_oss_test_run.tgz" + download_from_blob_bucket(blob_properties["object_id"], local_destination) + + return local_destination +end + +def blob_contains(blob_path, filename) + tar_extract = Gem::Package::TarReader.new(Zlib::GzipReader.open(blob_path)) + tar_extract.rewind # The extract has to be rewinded after every iteration + tar_extract.count { |entry| /#{filename}/.match(entry.full_name) } != 0 +end
Add spec to check OSS compliance of erlang blob [#115611161] Signed-off-by: Houssem El Fekih <79fadb0a34afe753d9a3e9572acabeee9978c197@pivotal.io>
diff --git a/lib/radbeacon.rb b/lib/radbeacon.rb index abc1234..def5678 100644 --- a/lib/radbeacon.rb +++ b/lib/radbeacon.rb @@ -1,10 +1,9 @@ require "radbeacon/version" require "radbeacon/le_scanner" require "radbeacon/bluetooth_le_device" +require "radbeacon/utils" require "radbeacon/scanner" require "radbeacon/usb" -require "radbeacon/utils" - module Radbeacon end
Reorder require statements so Utils is before Usb
diff --git a/libraries/nsd3.rb b/libraries/nsd3.rb index abc1234..def5678 100644 --- a/libraries/nsd3.rb +++ b/libraries/nsd3.rb @@ -22,12 +22,15 @@ def generate_nsd3_conf_section(lines, data, prefix="\t") data.each do |tag, value_or_values| + # Does not work as intended because deep merge ignores nil values always so no reset possible next if value_or_values.nil? # skip nil values -> support deleting a presetted value (value_or_values.kind_of?(Array) ? value_or_values : [ value_or_values ]).each do |value| if value.kind_of? TrueClass lines << "#{prefix}#{tag}: yes" elsif value.kind_of? FalseClass lines << "#{prefix}#{tag}: no" + elsif value == '' + next else lines << "#{prefix}#{tag}: #{value.to_s}" end
Allow reset of predefined value
diff --git a/assignments/ruby/bob/example.rb b/assignments/ruby/bob/example.rb index abc1234..def5678 100644 --- a/assignments/ruby/bob/example.rb +++ b/assignments/ruby/bob/example.rb @@ -13,7 +13,7 @@ class AnswerQuestion def self.handles?(input) - input.include?('?') + input.end_with?('?') end def reply
Fix implementation of question in ruby:bob
diff --git a/lingohub.gemspec b/lingohub.gemspec index abc1234..def5678 100644 --- a/lingohub.gemspec +++ b/lingohub.gemspec @@ -3,17 +3,15 @@ Gem::Specification.new do |gem| gem.name = 'lingohub' gem.version = Lingohub::VERSION - gem.author = 'lingohub GmbH' - gem.email = 'team@lingohub.com' + gem.authors = [ 'lingohub GmbH' ] + gem.email = [ 'team@lingohub.com' ] + gem.description = 'Client library and command-line tool to translate Ruby based apps with lingohub.' + gem.summary = gem.description gem.homepage = 'https://lingohub.com' - - gem.summary = 'Client library and CLI to translate Ruby based apps with lingohub.' - gem.description = 'Client library and command-line tool to translate Ruby based apps with lingohub.' gem.executables = 'lingohub' - # If you need to check in files that aren't .rb files, add them here + gem.require_paths = %w[lib] gem.files = Dir['{lib}/**/*.rb', 'bin/*', 'LICENSE', '*.md'] - gem.require_paths = %w[lib] gem.add_dependency 'rest-client', '~> 1.6.7' gem.add_dependency 'launchy', '~> 2.0.5'
Rearrange gem specification declarations slightly
diff --git a/linguist.gemspec b/linguist.gemspec index abc1234..def5678 100644 --- a/linguist.gemspec +++ b/linguist.gemspec @@ -11,6 +11,6 @@ s.add_dependency 'charlock_holmes', '~> 0.6.6' s.add_dependency 'escape_utils', '~> 0.2.3' s.add_dependency 'mime-types', '~> 1.18' - s.add_dependency 'pygments.rb', '~> 0.2.9' + s.add_dependency 'pygments.rb', '~> 0.2.10' s.add_development_dependency 'rake' end
Use an even newer Pygments
diff --git a/lita-irc.gemspec b/lita-irc.gemspec index abc1234..def5678 100644 --- a/lita-irc.gemspec +++ b/lita-irc.gemspec @@ -1,12 +1,13 @@ Gem::Specification.new do |spec| spec.name = "lita-irc" - spec.version = "1.2.1" + spec.version = "1.2.2" spec.authors = ["Jimmy Cuadra"] spec.email = ["jimmy@jimmycuadra.com"] spec.description = %q{An IRC adapter for Lita.} spec.summary = %q{An IRC adapter for the Lita chat robot.} spec.homepage = "https://github.com/jimmycuadra/lita-irc" spec.license = "MIT" + spec.metadata = { "lita_plugin_type" => "adapter" } spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
Add plugin type metadata and bump version to 1.2.2.
diff --git a/test/factories.rb b/test/factories.rb index abc1234..def5678 100644 --- a/test/factories.rb +++ b/test/factories.rb @@ -23,7 +23,8 @@ Factory.define :user do |u| u.username { Factory.next(:usernames) } - u.author {|a| Factory(:author, :username => a.username, :created_at => a.created_at) } + u.email { Factory.next(:emails) } + u.author {|a| Factory(:author, :username => a.username, :created_at => a.created_at, :email => a.email) } end Factory.sequence :integer do |i|
Change where email is set on a factoried user Since a local user controls its author's email, mirror that in the factory
diff --git a/lunokhod.gemspec b/lunokhod.gemspec index abc1234..def5678 100644 --- a/lunokhod.gemspec +++ b/lunokhod.gemspec @@ -23,6 +23,7 @@ spec.add_development_dependency "bundler", "~> 1.2" spec.add_development_dependency "rake" + spec.add_development_dependency 'benchmark_suite' spec.add_development_dependency 'kpeg' spec.add_development_dependency 'rspec' end
Use benchmark_suite to benchmark the parser and other bits.
diff --git a/test/integration/config/client_rb_spec.rb b/test/integration/config/client_rb_spec.rb index abc1234..def5678 100644 --- a/test/integration/config/client_rb_spec.rb +++ b/test/integration/config/client_rb_spec.rb @@ -1,8 +1,14 @@-describe command('ohai virtualization -c /etc/chef/client.rb') do +if os.windows? + config = 'C:\chef\client.rb' +else + config = '/etc/chef/client.rb' +end + +describe command("ohai virtualization -c #{config}") do its(:exit_status) { should eq(0) } end -describe file('/etc/chef/client.rb') do +describe file(config) do its('content') { should match(/ohai.disabled_plugins = \["Mdadm"\]/) } its('content') { should match(%r{ohai.plugin_path << "/tmp/kitchen/ohai/plugins"}) } end
Fix a few failing tests on Windows Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/test/integration/universe_stories_test.rb b/test/integration/universe_stories_test.rb index abc1234..def5678 100644 --- a/test/integration/universe_stories_test.rb +++ b/test/integration/universe_stories_test.rb @@ -0,0 +1,43 @@+require 'test_helper' + +# Tests scenarios related to interacting with Universes +class UniverseStoriesTest < ActionDispatch::IntegrationTest + setup do + @user = log_in_as_user + @universe = create(:universe, user: @user) + end + + test 'universe is displayed on universes list' do + visit universes_path + assert page.has_content?(@universe.name), + "Page body didn't contain universe name: "\ + "#{@universe.name} not found in \n#{page.body}" + end + + test 'universe list edit button edits universe' do + visit universe_path(@universe) + click_on 'Edit this universe' + assert_equal edit_universe_path(@universe), current_path + end + + test 'universe list view button shows universe' do + visit universes_path + within(:css, '.collection-item:first') do + click_on @universe.name + end + assert_equal universe_path(@universe), current_path, + "Not on universe path for universe #{@universe.name}: "\ + "#{@universe.name} not found in \n#{page.body}" + end + + test 'a user can create a new universe' do + new_universe = build(:universe) + visit universes_path + click_on 'Create another universe' + fill_in 'universe_name', with: new_universe.name + click_on 'Create Universe' + + assert_equal universe_path(Universe.where(name: new_universe.name).first), + current_path + end +end
Write a universes integration test
diff --git a/terraform/aws/scenarios/omnibus-external-elasticsearch/files/chef-server.rb b/terraform/aws/scenarios/omnibus-external-elasticsearch/files/chef-server.rb index abc1234..def5678 100644 --- a/terraform/aws/scenarios/omnibus-external-elasticsearch/files/chef-server.rb +++ b/terraform/aws/scenarios/omnibus-external-elasticsearch/files/chef-server.rb @@ -11,3 +11,4 @@ opscode_solr4['external'] = true opscode_solr4['external_url'] = 'http://elasticsearch.internal:9200' opscode_erchef['search_provider'] = 'elasticsearch' +opscode_erchef['search_queue_mode'] = 'batch'
Fix elasticsearch test scenario configuration The elasticsearch provider is only supported by the batch or inline queue modes. Signed-off-by: Christopher A. Snapp <dffaa860ed97a8fe2bd7fd9817f16f80af273fae@chef.io>
diff --git a/mit-ldap.gemspec b/mit-ldap.gemspec index abc1234..def5678 100644 --- a/mit-ldap.gemspec +++ b/mit-ldap.gemspec @@ -7,9 +7,9 @@ s.version = MIT::LDAP::VERSION s.authors = ["Eduardo Gutierrez"] s.email = ["edd_d@mit.edu"] - s.homepage = "" - s.summary = %q{Wrapper for MIT LDAP server} - s.description = %q{Configure Ldaptic to search MIT LDAP server} + s.homepage = "https://github.com/ecbypi/mit-ldap" + s.summary = %q{Ruby interface for querying MIT LDAP server} + s.description = %q{Ruby interface for querying MIT LDAP server (only if you're on MITnet)} s.rubyforge_project = "mit-ldap"
Add homepage and update descriptions
diff --git a/broach.gemspec b/broach.gemspec index abc1234..def5678 100644 --- a/broach.gemspec +++ b/broach.gemspec @@ -1,9 +1,7 @@-require 'rake' - Gem::Specification.new do |spec| spec.name = 'broach' spec.version = '0.1.4' - + spec.author = "Manfred Stienstra" spec.email = "manfred@fngtps.com" @@ -16,7 +14,15 @@ spec.add_dependency('nap', '>= 0.3') - spec.files = FileList['LICENSE', 'lib/**/*.rb'].to_a + spec.files = [ + 'LICENSE', + 'lib/broach/attributes.rb', + 'lib/broach/exceptions.rb', + 'lib/broach/room.rb', + 'lib/broach/session.rb', + 'lib/broach/user.rb', + 'lib/broach.rb', + ] spec.has_rdoc = true spec.extra_rdoc_files = ['LICENSE']
Remove the Rake dependency from the gemspec.
diff --git a/hashie.gemspec b/hashie.gemspec index abc1234..def5678 100644 --- a/hashie.gemspec +++ b/hashie.gemspec @@ -1,18 +1,18 @@ require File.expand_path('../lib/hashie/version', __FILE__) Gem::Specification.new do |gem| + gem.name = 'hashie' + gem.version = Hashie::VERSION gem.authors = ['Michael Bleigh', 'Jerry Cheung'] gem.email = ['michael@intridea.com', 'jollyjerry@gmail.com'] gem.description = 'Hashie is a collection of classes and mixins that make hashes more powerful.' gem.summary = 'Your friendly neighborhood hash library.' gem.homepage = 'https://github.com/intridea/hashie' + gem.license = 'MIT' + gem.require_paths = ['lib'] gem.files = `git ls-files`.split("\n") gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - gem.name = 'hashie' - gem.require_paths = ['lib'] - gem.version = Hashie::VERSION - gem.license = 'MIT' gem.add_development_dependency 'rake' gem.add_development_dependency 'rspec', '~> 3.0'
Reorganize gemspec according to common convention
diff --git a/lib/gitolite/gitolite_admin.rb b/lib/gitolite/gitolite_admin.rb index abc1234..def5678 100644 --- a/lib/gitolite/gitolite_admin.rb +++ b/lib/gitolite/gitolite_admin.rb @@ -17,10 +17,22 @@ @config = Config.new(File.join(path, conf)) end - def add_key(key) + #Writes all aspects out to the file system + #will also stage all changes + def save + #Process config file + + #Process ssh keys end - def key_exists?(key) + #commits all staged changes and pushes back + #to origin + def apply + status = @gl_admin.status + end + + #Calls save and apply in order + def save_and_apply end private
Add initial methods for saving back to disk
diff --git a/homebrew/chruby-fish.rb b/homebrew/chruby-fish.rb index abc1234..def5678 100644 --- a/homebrew/chruby-fish.rb +++ b/homebrew/chruby-fish.rb @@ -2,8 +2,8 @@ class ChrubyFish < Formula homepage 'https://github.com/JeanMertz/chruby-fish#readme' - url 'https://github.com/JeanMertz/chruby-fish/archive/v0.5.4.tar.gz' - sha1 'bcc27a6ea7d411ce3c47c44967f3fe27750c653f' + url 'https://github.com/JeanMertz/chruby-fish/archive/v0.6.0.tar.gz' + sha1 'e8262283018137db89ba5031ec088a5df3df19d0' head 'https://github.com/JeanMertz/chruby-fish.git'
Update Homebrew formula for v0.6.0
diff --git a/PlanetExpress/spec/routing/planet_express/zoidbergs_routing_spec.rb b/PlanetExpress/spec/routing/planet_express/zoidbergs_routing_spec.rb index abc1234..def5678 100644 --- a/PlanetExpress/spec/routing/planet_express/zoidbergs_routing_spec.rb +++ b/PlanetExpress/spec/routing/planet_express/zoidbergs_routing_spec.rb @@ -30,7 +30,8 @@ end it "routes to #update" do - expect(put: "/zoidbergs/1").to route_to(controller: pzc, action: "update", id: "1") + expect(patch: "/zoidbergs/1").to route_to(controller: pzc, action: "update", id: "1") + expect(put: "/zoidbergs/1").to route_to(controller: pzc, action: "update", id: "1") end it "routes to #destroy" do
Add PATCH update spec for Zoidbergs
diff --git a/examples/queues_default_name.rb b/examples/queues_default_name.rb index abc1234..def5678 100644 --- a/examples/queues_default_name.rb +++ b/examples/queues_default_name.rb @@ -0,0 +1,18 @@+# Example of how Qu works with graceful shutdown turned on. +require_relative './example_setup' + +Qu.configure do |config| + config.graceful_shutdown = true +end + +class CallTheNunes < Qu::Job + def perform + logger.info 'calling the nunes' + end +end + +payload = CallTheNunes.create + +Qu.logger.info "Queue used: #{payload.queue}" + +work_and_die
Add example of default queue.
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index abc1234..def5678 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -21,3 +21,5 @@ %w[images fonts javascripts].each do |asset| assets_path.insert(0, Rails.root.join("app", "assets", asset, "custom").to_s) end + +Rails.application.config.assets.precompile += Ckeditor.assets
Fix ckeditor link, another try
diff --git a/Library/Homebrew/test/cmd/cat_spec.rb b/Library/Homebrew/test/cmd/cat_spec.rb index abc1234..def5678 100644 --- a/Library/Homebrew/test/cmd/cat_spec.rb +++ b/Library/Homebrew/test/cmd/cat_spec.rb @@ -8,4 +8,13 @@ .and not_to_output.to_stderr .and be_a_success end + + it "fails when given multiple arguments" do + setup_test_formula "foo" + setup_test_formula "bar" + expect { brew "cat", "foo", "bar" } + .to output(/doesn't support multiple arguments/).to_stderr + .and not_to_output.to_stdout + .and be_a_failure + end end
Add multiple arguments test for brew cat
diff --git a/install-program-list.rb b/install-program-list.rb index abc1234..def5678 100644 --- a/install-program-list.rb +++ b/install-program-list.rb @@ -0,0 +1,21 @@+#!/usr/bin/env ruby + +# Install brew and gems as listed in `brew` and `gems` folder. + +require 'rake' + +def installFrom(filePath) + File.foreach(filePath) { |line| + name = line.chomp + yeild name + } +end + +brewListPath = "brew" + File::SEPARATOR + "brew-list" +installFrom(brewListPath) {|i| sh "brew install #{i}"} + +brewCaskListPath = "brew" + File::SEPARATOR + "brew-cask-list" +installFrom(brewCaskListPath) {|i| sh "brew cask install #{i}"} + +gemListPath = "gems" + File::SEPARATOR + "gem-list" +installFrom(gemListPath) {|i| sh "gem install #{i}"}
Add script to install programs from lists
diff --git a/db/migrate/076_add_indices.rb b/db/migrate/076_add_indices.rb index abc1234..def5678 100644 --- a/db/migrate/076_add_indices.rb +++ b/db/migrate/076_add_indices.rb @@ -0,0 +1,9 @@+class AddIndices < ActiveRecord::Migration + def self.up + add_index :track_things_sent_emails, :track_thing_id + end + + def self.down + remove_index :track_things_sent_emails, :track_thing_id + end +end
Add an index Alex found was missing.
diff --git a/cfndsl.gemspec b/cfndsl.gemspec index abc1234..def5678 100644 --- a/cfndsl.gemspec +++ b/cfndsl.gemspec @@ -21,6 +21,6 @@ s.executables << 'cfndsl' - s.add_development_dependency 'bundler', '~> 1.17' + s.add_development_dependency 'bundler', '~> 2.0' s.add_runtime_dependency 'hana', '~> 1.3' end
Upgrade dev dependency to bundler 2
diff --git a/app/controllers/remote_database_cleaner_home_rails/home_controller.rb b/app/controllers/remote_database_cleaner_home_rails/home_controller.rb index abc1234..def5678 100644 --- a/app/controllers/remote_database_cleaner_home_rails/home_controller.rb +++ b/app/controllers/remote_database_cleaner_home_rails/home_controller.rb @@ -9,7 +9,8 @@ DatabaseCleaner.clean render json: {response: 200} else - render json: { status: 403 }, status: 403 + forbidden = 403 + render json: { status: forbidden }, status: forbidden end end
Make status code a variable
diff --git a/lib/ansible/transmit.rb b/lib/ansible/transmit.rb index abc1234..def5678 100644 --- a/lib/ansible/transmit.rb +++ b/lib/ansible/transmit.rb @@ -24,8 +24,7 @@ beacon = __method__ headers['Content-Type'] = 'text/event-stream' sse = SSE.new(response.stream) - loop do - break if transmit_que[beacon].empty? + until transmit_que[beacon].empty? event, message = transmit_que[beacon].pop.flatten sse.write(event, message) end
Use "until" instead of "loop do"
diff --git a/kumade.gemspec b/kumade.gemspec index abc1234..def5678 100644 --- a/kumade.gemspec +++ b/kumade.gemspec @@ -18,6 +18,7 @@ s.add_dependency('heroku', '~> 2.0') s.add_dependency('thor', '~> 0.14') + s.add_dependency('rake', '~> 0.8.7') s.add_development_dependency('rake', '~> 0.8.7') s.add_development_dependency('rspec', '~> 2.6.0')
Fix to work with 1.8.7 again.
diff --git a/lib/travis/github/services/find_or_create_repo.rb b/lib/travis/github/services/find_or_create_repo.rb index abc1234..def5678 100644 --- a/lib/travis/github/services/find_or_create_repo.rb +++ b/lib/travis/github/services/find_or_create_repo.rb @@ -13,7 +13,7 @@ private def find - run_service(:find_repo, params) + run_service(:find_repo, :owner_name => params[:owner_name], :name => params[:name]) end def create
Use only relevant params when searching for repo
diff --git a/test/helpers/helper_test.rb b/test/helpers/helper_test.rb index abc1234..def5678 100644 --- a/test/helpers/helper_test.rb +++ b/test/helpers/helper_test.rb @@ -0,0 +1,33 @@+require File.expand_path('../../test_helper', __FILE__) + +class HelperTestController < ActionController::Base + def test + render text: nil + end +end + +class TestHelperTest < ActionView::TestCase + include RouteTranslator::ConfigurationHelper + include RouteTranslator::RoutesHelper + + def setup + setup_config + config_default_locale_settings 'en' + + @routes = ActionDispatch::Routing::RouteSet.new + + draw_routes do + localized do + get :helper_test, to: 'helper_test#test' + end + end + end + + def teardown + teardown_config + end + + def test_no_private_method_call + helper_test_path + end +end
Add action view test case
diff --git a/lib/omc/cli.rb b/lib/omc/cli.rb index abc1234..def5678 100644 --- a/lib/omc/cli.rb +++ b/lib/omc/cli.rb @@ -14,7 +14,7 @@ instances = ops.describe_instances(stack_id: ops_stack[:stack_id])[:instances] instances.reject!{|i| i[:status] != "online" } instance = instances.first || abort("No running instances") - system "ssh #{user.name}@#{instance[:public_ip]}" + exec "ssh", "#{user.name}@#{instance[:public_ip]}" end private
Use exec instead of leaving a waiting ruby process Change-Id: Ia9c190b96803a6950d895e99a2546879329e1f35
diff --git a/api/app/models/hackbot/interactions/greeter.rb b/api/app/models/hackbot/interactions/greeter.rb index abc1234..def5678 100644 --- a/api/app/models/hackbot/interactions/greeter.rb +++ b/api/app/models/hackbot/interactions/greeter.rb @@ -12,6 +12,10 @@ def start im = SlackClient::Chat.open_im(event[:user], access_token) + return unless im[:ok] + + return if im[:already_open] + SlackClient::Chat.send_msg( im[:channel][:id], copy('greeting'),
Fix Orpheus sending multiple messages to new users
diff --git a/app/models/concerns/prev_nextable.rb b/app/models/concerns/prev_nextable.rb index abc1234..def5678 100644 --- a/app/models/concerns/prev_nextable.rb +++ b/app/models/concerns/prev_nextable.rb @@ -7,12 +7,12 @@ # For Event object, start_date is used to determine the previous record included do def fetch_prev - return self.class.where('start_date < ?', start_date).online.last if self.class.name == 'Event' + return self.class.where('start_date < ? AND id <> ?', start_date, id).online.last if self.class.name == 'Event' self.class.where('id < ?', id).online.last end def fetch_next - return self.class.where('start_date > ?', start_date).online.first if self.class.name == 'Event' + return self.class.where('start_date > ? AND id <> ?', start_date, id).online.first if self.class.name == 'Event' self.class.where('id > ?', id).online.first end
Fix broken tests with Sqlite3 adapter
diff --git a/app/services/notes/create_service.rb b/app/services/notes/create_service.rb index abc1234..def5678 100644 --- a/app/services/notes/create_service.rb +++ b/app/services/notes/create_service.rb @@ -3,6 +3,7 @@ def execute note = project.notes.new(params[:note]) note.author = current_user + note.system = false note.save note end
Make sure note.system is false if created by user Signed-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>
diff --git a/app/workers/thread_resolve_worker.rb b/app/workers/thread_resolve_worker.rb index abc1234..def5678 100644 --- a/app/workers/thread_resolve_worker.rb +++ b/app/workers/thread_resolve_worker.rb @@ -3,7 +3,7 @@ class ThreadResolveWorker include Sidekiq::Worker - sidekiq_options queue: 'pull', retry: false + sidekiq_options queue: 'pull', retry: 5 def perform(child_status_id, parent_url) child_status = Status.find(child_status_id)
Change ThreadResolveWorker retry value to 5
diff --git a/app/controllers/buckets_controller.rb b/app/controllers/buckets_controller.rb index abc1234..def5678 100644 --- a/app/controllers/buckets_controller.rb +++ b/app/controllers/buckets_controller.rb @@ -23,6 +23,7 @@ # POST /buckets def create @bucket = Bucket.new(bucket_params) + @bucket.team_id = current_user.team_id if @bucket.save redirect_to @bucket, notice: 'Bucket was successfully created.'
Set bucket team_id on create
diff --git a/app/controllers/reviews_controller.rb b/app/controllers/reviews_controller.rb index abc1234..def5678 100644 --- a/app/controllers/reviews_controller.rb +++ b/app/controllers/reviews_controller.rb @@ -9,7 +9,6 @@ def create review = Review.new(review_params) - review.update_attributes(reviewer_id: current_user.id) reviewee = User.find(review.reviewee_id) if review.save reputation = reviewee.get_reputation @@ -33,7 +32,7 @@ private def review_params - params.require(:review).permit(:rating, :content, :trip_id, :parcel_id, :reviewee_id) + params.require(:review).permit(:rating, :content, :trip_id, :parcel_id, :reviewee_id).merge(reviewer_id: current_user.id) end end
Add merge to review params in controller to assign reviewer id to current user id
diff --git a/webadmin/start.rb b/webadmin/start.rb index abc1234..def5678 100644 --- a/webadmin/start.rb +++ b/webadmin/start.rb @@ -20,8 +20,9 @@ revision = params[:revision].ergo.to_s[/(\w+)/, 1] @command = nil - common_restart = %{bundle exec rake RAILS_ENV=production clear && (bundle check || bundle --local || sudo bundle) && touch #{RESTART_TXT}} - common_deploy = %{bundle exec rake RAILS_ENV=production db:migrate && #{common_restart}} + common_bundle = %{bundle check || bundle --local || sudo bundle} + common_restart = %{(#{common_bundle}) && bundle exec rake RAILS_ENV=production clear && touch #{RESTART_TXT}} + common_deploy = %{(#{common_bundle}) && bundle exec rake RAILS_ENV=production db:migrate && #{common_restart}} case action when "deploy_and_migrate_via_update" if revision
Fix webadmin to run bundle before migrations.
diff --git a/dashboard/test/integration/twilio_sms_test.rb b/dashboard/test/integration/twilio_sms_test.rb index abc1234..def5678 100644 --- a/dashboard/test/integration/twilio_sms_test.rb +++ b/dashboard/test/integration/twilio_sms_test.rb @@ -0,0 +1,51 @@+require 'test_helper' +require 'twilio-ruby' + +class TwilioSmsTest < ActionDispatch::IntegrationTest + + test 'Send and receive Twilio SMS on carrier network' do + skip 'Run this test manually with TEST_SMS=1' unless ENV['TEST_SMS'] + + # This end-to-end SMS test requires a smartphone with carrier-specific (e.g. AT&T) phone number twilio_phone_test_to, + # running an auto-forwarder configured to forward SMS messages from twilio_phone to twilio_phone_test_forward. + # + # Tested using Auto SMS(lite) https://play.google.com/store/apps/details?id=com.tmnlab.autoresponder + # + # The test will use the Twilio API to send a test message from twilio_phone to twilio_phone_test_to, + # wait for a short period of time, then use the Twilio API to locate an inbound message to + # twilio_phone_test_forward containing the same unique ID. + + # credentials + ACCOUNT_SID = CDO.twilio_sid + AUTH_TOKEN = CDO.twilio_auth + SMS_FROM = CDO.twilio_phone + SMS_TEST_FORWARD = CDO.twilio_phone_test_forward + SMS_TEST_TO = CDO.twilio_phone_test_to + + # Send a message from twilio_phone to test_to number + @client = Twilio::REST::Client.new ACCOUNT_SID, AUTH_TOKEN + test_body = "Test: #{SecureRandom.urlsafe_base64}." + @client.messages.create( + :from => SMS_FROM, + :to => SMS_TEST_TO, + :body => test_body + ) + + # Wait for test_forward number to receive the auto-forwarded response + TOTAL_TRIES = 10 + num_tries = 0 + loop do + sleep 3 + @client = Twilio::REST::Client.new ACCOUNT_SID, AUTH_TOKEN + break if @client.messages.list( + to: SMS_TEST_FORWARD, + from: SMS_TEST_TO, + date_sent: DateTime.now.strftime('%Y-%m-%d') + ).detect { |message| message.body.include? test_body } + num_tries += 1 + if num_tries > TOTAL_TRIES + raise "SMS test failed. From: #{SMS_FROM}, to: #{SMS_TEST_TO}, forward: #{SMS_TEST_FORWARD}, message: #{test_body}" + end + end + end +end
Add integration test for receiving Twilio SMS on carrier network
diff --git a/app/services/groups/update_service.rb b/app/services/groups/update_service.rb index abc1234..def5678 100644 --- a/app/services/groups/update_service.rb +++ b/app/services/groups/update_service.rb @@ -30,7 +30,7 @@ return true unless changing_share_with_group_lock? return true if can?(current_user, :change_share_with_group_lock, group) - group.errors.add(:share_with_group_lock, 'cannot be disabled when the parent group Share lock is enabled, except by the owner of the parent group') + group.errors.add(:share_with_group_lock, s_('GroupSettings|cannot be disabled when the parent group Share with group lock is enabled, except by the owner of the parent group')) false end
Make UpdateService error message translatable
diff --git a/lib/rlm_ruby/license.rb b/lib/rlm_ruby/license.rb index abc1234..def5678 100644 --- a/lib/rlm_ruby/license.rb +++ b/lib/rlm_ruby/license.rb @@ -5,7 +5,8 @@ class License def self.generate_keys(contact = {}, products = []) - req = Net::HTTP::Post.new(RlmRuby.configuration.uri, initheader = {'Content-Type' =>'application/json'}) + uri = URI(RlmRuby.configuration.uri) + req = Net::HTTP::Post.new(uri, {'Content-Type' => 'application/json'}) req.basic_auth RlmRuby.configuration.username, RlmRuby.configuration.password req.body = { header:{ @@ -16,14 +17,12 @@ data: { contact: contact[:name], - contact_notes: "via Cogmation Storefront on #{Time.now.strftime('%m/%d/%Y')}", phone: contact[:phone], email: contact[:email], - notes: "via Cogmation Storefront on #{Time.now.strftime('%m/%d/%Y')}", products: products } }.to_json - Net::HTTP.new(RlmRuby.configuration.host, RlmRuby.configuration.port).start {|http| http.request(req) } + Net::HTTP.new(RlmRuby.configuration.host).start {|http| http.request(req) } end end
Send the products SKU inside note for reference later
diff --git a/lib/shamrock/service.rb b/lib/shamrock/service.rb index abc1234..def5678 100644 --- a/lib/shamrock/service.rb +++ b/lib/shamrock/service.rb @@ -5,13 +5,13 @@ def initialize(rack_app, handler = Rack::Handler::WEBrick, - monitor = Shamrock::Monitor) + monitor = Monitor) @rack_app = rack_app @handler = handler @port = Port.new @url = "http://localhost:#{port.number}" - @monitor = monitor.new(Shamrock::Http.new(url)) + @monitor = monitor.new(Http.new(url)) end def start
Remove full namespacing when not needed
diff --git a/lib/tasks/guidance.rake b/lib/tasks/guidance.rake index abc1234..def5678 100644 --- a/lib/tasks/guidance.rake +++ b/lib/tasks/guidance.rake @@ -1,10 +1,32 @@ require 'logger' namespace :guidance do - task :import_csv, [:file] => [:environment] do |t, args| + task :import_csv, [:file, :topic, :organisation, :creator] => [:environment] do |t, args| + topic = Topic.where(name: args[:topic]).first + organisation = Organisation.where(name: args[:organisation]).first + creator = User.where(email: args[:creator]).first + unless topic && organisation && creator + return "Must provide a valid topic, organisation, and creator" + end + + new_guides = 0 + updated_guides = 0 + CSV.foreach(args[:file], {:headers => true}) do |row| - puts row + title = row[0] + body = row[1] + + existing_guide = SpecialistGuide.where(title: title).first + + if existing_guide + existing_guide.body = body + existing_guide.save && updated_guides += 1 + else + guide = SpecialistGuide.new(title: title, body: body, state: "draft", topics: [topic], organisations: [organisation], creator: creator) + guide.save && new_guides += 1 + end end + puts "#{new_guides} created and #{updated_guides} updated" end desc "Upload CSVs of Specialist Guidance content to the database"
Update importer to count rows and use passed in data Invoke with: rake guidance:import_csv[file,topic_name,org_name,author_email]