diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/test/mactag/tag/gem_test.rb b/test/mactag/tag/gem_test.rb index abc1234..def5678 100644 --- a/test/mactag/tag/gem_test.rb +++ b/test/mactag/tag/gem_test.rb @@ -12,4 +12,31 @@ end end + context "gem without version" do + context "one gem" do + setup do + Dir.stubs(:glob).returns("whenever") + + @gem = Mactag::Tag::Gem.new("whenever") + end + + should "return that gem" do + assert_contains @gem.files, "whenever/**/*.rb" + end + end + + context "multiple gems" do + setup do + Dir.stubs(:glob).returns(["whenever-0.3.7", "whenever-0.3.6"]) + + @gem = Mactag::Tag::Gem.new("whenever") + end + + should "return the gem with the latest version" do + assert_contains @gem.files, "whenever-0.3.7/**/*.rb" + assert_does_not_contain @gem.files, "whenever-0.3.6/**/*.rb" + end + end + end + end
Test other cases aswell in gem tag test using stubs.
diff --git a/lib/vim-flavor/stringextension.rb b/lib/vim-flavor/stringextension.rb index abc1234..def5678 100644 --- a/lib/vim-flavor/stringextension.rb +++ b/lib/vim-flavor/stringextension.rb @@ -10,7 +10,7 @@ end def to_flavors_path - "#{self}/flavors" + "#{self}/pack/flavors/start" end def to_lockfile_path
Update to_flavors_path to install as Vim packages
diff --git a/lib/wheaties/responses/welcome.rb b/lib/wheaties/responses/welcome.rb index abc1234..def5678 100644 --- a/lib/wheaties/responses/welcome.rb +++ b/lib/wheaties/responses/welcome.rb @@ -4,6 +4,13 @@ # RPL_ENDOFMOTD def on_376 log(:debug, "Connection established") + + performs = Wheaties.config["auto"] + performs.each do |command| + if command =~ /^(.*?)\s+(.*)$/ + broadcast($~[1], $~[2]) + end + end channels = Wheaties.config["channels"] channels.each do |channel|
Add ability to perform commands automatically once a connection is established
diff --git a/jekyll-fridge.gemspec b/jekyll-fridge.gemspec index abc1234..def5678 100644 --- a/jekyll-fridge.gemspec +++ b/jekyll-fridge.gemspec @@ -4,7 +4,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'bundler', '~> 1.0' - spec.add_dependency 'jekyll', '~> 2.5.3' + spec.add_dependency 'jekyll', '>= 2.0' spec.add_dependency 'fridge_api', '~> 0.2.2' spec.authors = ["Mike Kruk"] spec.email = ['mike@ripeworks.com']
chore(gemspec): Update jekyll version dependency to get it working with jekyll v3
diff --git a/stradivari.gemspec b/stradivari.gemspec index abc1234..def5678 100644 --- a/stradivari.gemspec +++ b/stradivari.gemspec @@ -24,4 +24,5 @@ spec.add_runtime_dependency 'pg_search' spec.add_runtime_dependency 'ransack' + spec.add_runtime_dependency 'haml', [">= 3.1", "< 5.0"] end
Add HAML as a dependency
diff --git a/spec/ffi/async_callback_spec.rb b/spec/ffi/async_callback_spec.rb index abc1234..def5678 100644 --- a/spec/ffi/async_callback_spec.rb +++ b/spec/ffi/async_callback_spec.rb @@ -14,9 +14,10 @@ it ":int (0x7fffffff) argument" do v = 0xdeadbeef called = false - LibTest.testAsyncCallback(0x7fffffff) { |i| v = i; called = true } + cb = Proc.new {|i| v = i; called = true } + LibTest.testAsyncCallback(cb, 0x7fffffff) called.should be_true v.should == 0x7fffffff end end -end+end
Tweak the async callback spec to hold a ref to the callback proc, so it doesn't get garbage collected during the thread deferal
diff --git a/deferrer.gemspec b/deferrer.gemspec index abc1234..def5678 100644 --- a/deferrer.gemspec +++ b/deferrer.gemspec @@ -22,5 +22,5 @@ spec.add_dependency "multi_json" spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" - spec.add_development_dependency "rspec" + spec.add_development_dependency "rspec", "~> 2.14.1" end
Use old version of rspec
diff --git a/spec/bundler/lockfile_parser_spec.rb b/spec/bundler/lockfile_parser_spec.rb index abc1234..def5678 100644 --- a/spec/bundler/lockfile_parser_spec.rb +++ b/spec/bundler/lockfile_parser_spec.rb @@ -0,0 +1,94 @@+# frozen_string_literal: true +require "spec_helper" +require "bundler/lockfile_parser" + +describe Bundler::LockfileParser do + let(:lockfile_contents) { strip_whitespace(<<-L) } + GIT + remote: https://github.com/alloy/peiji-san.git + revision: eca485d8dc95f12aaec1a434b49d295c7e91844b + specs: + peiji-san (1.2.0) + + GEM + remote: https://rubygems.org/ + specs: + rake (10.3.2) + + PLATFORMS + ruby + + DEPENDENCIES + peiji-san! + rake + + RUBY VERSION + ruby 2.1.3p242 + + BUNDLED WITH + 1.12.0.rc.2 + L + + describe ".attributes_in_lockfile" do + it "returns the attributes" do + attributes = described_class.attributes_in_lockfile(lockfile_contents) + expect(attributes).to contain_exactly( + "BUNDLED WITH", "DEPENDENCIES", "GEM", "GIT", "PLATFORMS", "RUBY VERSION" + ) + end + end + + describe ".unknown_attributes_in_lockfile" do + let(:lockfile_contents) { strip_whitespace(<<-L) } + UNKNOWN ATTR + + UNKNOWN ATTR 2 + random contents + L + + it "returns the unknown attributes" do + attributes = described_class.unknown_attributes_in_lockfile(lockfile_contents) + expect(attributes).to contain_exactly("UNKNOWN ATTR", "UNKNOWN ATTR 2") + end + end + + describe ".attributes_to_ignore" do + subject { described_class.attributes_to_ignore(base_version) } + + context "with a nil base version" do + let(:base_version) { nil } + + it "returns the same as > 1.0" do + expect(subject).to contain_exactly( + described_class::BUNDLED, described_class::RUBY + ) + end + end + + context "with a prerelease base version" do + let(:base_version) { Gem::Version.create("1.11.0.rc.1") } + + it "returns the same as for the release version" do + expect(subject).to contain_exactly( + described_class::RUBY + ) + end + end + + context "with a current version" do + let(:base_version) { Gem::Version.create(Bundler::VERSION) } + + it "returns an empty array" do + expect(subject).to eq([]) + end + end + + context "with a future version" do + let(:base_version) { Gem::Version.create("5.5.5") } + + it "returns an empty array" do + expect(subject).to eq([]) + end + end + end +end
Add lockfile parser unit tests
diff --git a/lib/aviator/openstack/volume/v1/public/create_volume.rb b/lib/aviator/openstack/volume/v1/public/create_volume.rb index abc1234..def5678 100644 --- a/lib/aviator/openstack/volume/v1/public/create_volume.rb +++ b/lib/aviator/openstack/volume/v1/public/create_volume.rb @@ -24,7 +24,7 @@ } } - [:availability_zone, :metadata].each do |key| + optional_params.each do |key| p[:volume][key] = params[key] if params[key] end
Send all optional params on create volume
diff --git a/MsgPackSerialization.podspec b/MsgPackSerialization.podspec index abc1234..def5678 100644 --- a/MsgPackSerialization.podspec +++ b/MsgPackSerialization.podspec @@ -7,7 +7,7 @@ s.social_media_url = 'https://twitter.com/mattt' s.authors = { 'Mattt Thompson' => 'm@mattt.me' } s.source = { :git => 'https://github.com/mattt/MsgPackSerialization.git', :tag => '0.0.1' } - s.source_files = 'MsgPackSerialization' + s.source_files = 'MsgPackSerialization', 'MsgPackSerialization/msgpack_src/*.{c,h}', 'MsgPackSerialization/msgpack_src/msgpack/*.h' s.requires_arc = true s.ios.deployment_target = '5.0'
Add msgpack_src to pod source files.
diff --git a/app/controllers/index.rb b/app/controllers/index.rb index abc1234..def5678 100644 --- a/app/controllers/index.rb +++ b/app/controllers/index.rb @@ -18,7 +18,7 @@ end get '/signup' do - erb :sign_up + erb :signup #sign up form end
Correct name of signup erb
diff --git a/General/bottles-of-beer.rb b/General/bottles-of-beer.rb index abc1234..def5678 100644 --- a/General/bottles-of-beer.rb +++ b/General/bottles-of-beer.rb @@ -0,0 +1,10 @@+def beer (bottles) + (bottles).downto(0) do |bottle| + word = bottle == 1 ? 'bottle' : 'bottles' + bottle = bottle == 0 ? 'no more' : bottle + puts "#{(bottle.is_a? String) ? bottle.capitalize : bottle} #{word} of beer on the wall, #{bottle} #{word} of beer." + puts "Take one down, pass it around, #{bottle - 1} #{word} of beer on the wall." + end +end + +beer(99)
Solve bottles of beer problem in Ruby
diff --git a/app/models/ability.rb b/app/models/ability.rb index abc1234..def5678 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -8,9 +8,13 @@ if user.has_role? :admin can :manage, :all elsif user.has_role? :user - can :manage, Farm, user_id: user.id + can :manage, Farm do |farm| + farm.authorized?(user) + end can :create, Farm - can :manage, Depot, user_id: user.id + can :manage, Depot do |depot| + depot.authorized?(user) + end can :create, Depot can :create, Image can :read, :all
Update CanCan abilities to support multiple owners.
diff --git a/app/models/machine.rb b/app/models/machine.rb index abc1234..def5678 100644 --- a/app/models/machine.rb +++ b/app/models/machine.rb @@ -8,7 +8,7 @@ attr_accessible :theme_id, :service_id, :operating_system_id, :site_id, :physical_rack_id, :cddvd_id, :mainteneur_id, :nom, :ancien_nom, :sousreseau_ip, :quatr_octet, :numero_serie, :virtuelle, :description, :modele, :memoire, :frequence, :date_mes, :fin_garantie, :type_contrat, :type_disque, :taille_disque, :marque, :ref_proc, :type_serveur, :nb_proc, :nb_coeur, :nb_rj45, :nb_fc, :nb_iscsi, :type_disque_alt, :taille_disque_alt, :nb_disque, :nb_disque_alt, :ip, :application_ids - default_scope :include => :applications + default_scope :include => [:applications, :site] def ip i = sousreseau_ip.to_s.split(".")
Include :site association in Machine default_scope
diff --git a/app/models/section.rb b/app/models/section.rb index abc1234..def5678 100644 --- a/app/models/section.rb +++ b/app/models/section.rb @@ -9,4 +9,7 @@ default_scope { desc(:sort) } + validates :name, presence: true + validates :name, uniqueness: true + end
Add custom validators to the name field when saving the scetion.
diff --git a/jekyll-watch.gemspec b/jekyll-watch.gemspec index abc1234..def5678 100644 --- a/jekyll-watch.gemspec +++ b/jekyll-watch.gemspec @@ -9,9 +9,8 @@ spec.homepage = "https://github.com/jekyll/jekyll-watch" spec.license = "MIT" - spec.files = `git ls-files -z`.split("\x0") + spec.files = `git ls-files -z`.split("\x0").grep(%r{(bin|lib)/}) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_runtime_dependency "listen", "~> 2.7"
Remove test files from gem bundle. Fixes https://github.com/jekyll/jekyll-sass-converter/issues/24.
diff --git a/test/test_start.rb b/test/test_start.rb index abc1234..def5678 100644 --- a/test/test_start.rb +++ b/test/test_start.rb @@ -9,7 +9,7 @@ sftp = mock('sftp') # TODO: figure out how to verify a block is passed, and call it later. # I suspect this is hard to do properly with mocha. - Net::SFTP::Session.expects(:new).with(ssh).returns(sftp) + Net::SFTP::Session.expects(:new).with(ssh, nil).returns(sftp) sftp.expects(:connect!).returns(sftp) sftp.expects(:loop) @@ -17,4 +17,19 @@ # NOTE: currently not called! end end + + def test_with_block_and_options + ssh = mock('ssh') + ssh.expects(:close) + Net::SSH.expects(:start).with('host', 'user', auth_methods: ["password"]).returns(ssh) + + sftp = mock('sftp') + Net::SFTP::Session.expects(:new).with(ssh, 3).returns(sftp) + sftp.expects(:connect!).returns(sftp) + sftp.expects(:loop) + + Net::SFTP.start('host', 'user', {auth_methods: ["password"]}, {version: 3}) do + # NOTE: currently not called! + end + end end
Add test to cover protocol version passing
diff --git a/lib/celluloid/uuid.rb b/lib/celluloid/uuid.rb index abc1234..def5678 100644 --- a/lib/celluloid/uuid.rb +++ b/lib/celluloid/uuid.rb @@ -8,7 +8,7 @@ module UUID values = SecureRandom.hex(9).match(/(.{8})(.{4})(.{3})(.{3})/) PREFIX = "#{values[1]}-#{values[2]}-4#{values[3]}-8#{values[4]}".freeze - BLOCK_SIZE = 10_000 + BLOCK_SIZE = 0x10000 @counter = 0 @counter_mutex = Mutex.new
Use a block size that aligns with hexadecimal UUIDs
diff --git a/lib/active_record/annotate/dumper.rb b/lib/active_record/annotate/dumper.rb index abc1234..def5678 100644 --- a/lib/active_record/annotate/dumper.rb +++ b/lib/active_record/annotate/dumper.rb @@ -2,11 +2,11 @@ module Annotate module Dumper class << self - def dump(table_name, connection = ActiveRecord::Base.connection) + def dump(table_name, connection = ActiveRecord::Base.connection, config = ActiveRecord::Base) string_io = StringIO.new if connection.table_exists?(table_name) - dumper(connection).send(:table, table_name, string_io) + dumper(connection, config).send(:table, table_name, string_io) else string_io.write(" # can't find table `#{table_name}`") end @@ -15,8 +15,12 @@ end private - def dumper(connection) - ActiveRecord::SchemaDumper.send(:new, connection) + def dumper(connection, config) + if connection.respond_to?(:create_schema_dumper) + connection.create_schema_dumper(ActiveRecord::SchemaDumper.send(:generate_options, config)) + else + ActiveRecord::SchemaDumper.send(:new, connection) + end end def process_annotation(string_io)
Fix bug with Rails 5.2 https://github.com/ka8725/migration_data/issues/34#issuecomment-428790873
diff --git a/ci/cruise_config.rb b/ci/cruise_config.rb index abc1234..def5678 100644 --- a/ci/cruise_config.rb +++ b/ci/cruise_config.rb @@ -1,5 +1,5 @@ Project.configure do |project| - project.build_command = 'sudo gem update --system 1.6.2 && ruby ci/ci_build.rb' + project.build_command = 'sudo gem update --system && ruby ci/ci_build.rb' project.email_notifier.from = 'rails-ci@wyeworks.com' # project.campfire_notifier.account = 'rails'
Allow CI to use the latest rubygems version
diff --git a/atspi_app_driver.gemspec b/atspi_app_driver.gemspec index abc1234..def5678 100644 --- a/atspi_app_driver.gemspec +++ b/atspi_app_driver.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'atspi_app_driver' - s.version = '0.0.1' + s.version = '0.0.2' s.summary = 'Test GNOME applications using Atspi'
Prepare version 0.0.2 for release
diff --git a/actionpack/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb b/actionpack/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb index abc1234..def5678 100644 --- a/actionpack/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +++ b/actionpack/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb @@ -19,6 +19,7 @@ def after_teardown take_failed_screenshot Capybara.reset_sessions! + ensure super end end
Fix system tests transactions not closed between examples
diff --git a/spec/rspec/rails/configuration_spec.rb b/spec/rspec/rails/configuration_spec.rb index abc1234..def5678 100644 --- a/spec/rspec/rails/configuration_spec.rb +++ b/spec/rspec/rails/configuration_spec.rb @@ -1,26 +1,20 @@ require "spec_helper" -describe "configuration" do - before do - @orig_render_views = RSpec.configuration.render_views? - end +RSpec.describe "Configuration" do - after do - RSpec.configuration.render_views = @orig_render_views - end + subject(:config) { RSpec.configuration.clone } describe "#render_views?" do it "is false by default" do - expect(RSpec.configuration.render_views?).to be_falsey + expect(config.render_views?).to be_falsey end end describe "#render_views" do it "sets render_views? to return true" do - RSpec.configuration.render_views = false - RSpec.configuration.render_views - - expect(RSpec.configuration.render_views?).to be_truthy + expect { + config.render_views + }.to change { config.render_views? }.to be_truthy end end end
Update spec to remove hooks. This changes to nearly mirrors how the configuration is tested in rspec-core. Instead of setting up a new configuration object each test run, we clone the existing object. This does two things: - prevents polluting the actual test configuration - instead of creating a new configuration it clones the existing one to ensure we actually modify the RSpec config
diff --git a/lib/conjure/server.rb b/lib/conjure/server.rb index abc1234..def5678 100644 --- a/lib/conjure/server.rb +++ b/lib/conjure/server.rb @@ -1,15 +1,7 @@ require "conjure/digital_ocean/droplet" module Conjure - class Server - def initialize(server) - @server = server - end - - def ip_address - @server.ip_address - end - + class Server < Struct.new(:ip_address) def run(command) `ssh #{self.class.ssh_options} root@#{ip_address} #{quote_command command}` end @@ -27,7 +19,7 @@ end def self.create(name_prefix, options = {}) - new DigitalOcean::Droplet.new(droplet_options(name_prefix, options)) + new DigitalOcean::Droplet.new(droplet_options(name_prefix, options)).ip_address end def self.droplet_options(name_prefix, options = {})
Change Server to initialize with ip address
diff --git a/lib/em-rtmp/logger.rb b/lib/em-rtmp/logger.rb index abc1234..def5678 100644 --- a/lib/em-rtmp/logger.rb +++ b/lib/em-rtmp/logger.rb @@ -10,12 +10,6 @@ class << self attr_accessor :level - end - - def self.log(level, message) - @@file ||= File.open('/Users/jcoene/Desktop/em-rtmp.log', 'a') - @@file.write("[#{Time.now.strftime('%T')}] [#{level}] #{message}\n") - @@file.flush end def self.level(level)
Remove logging to file directly
diff --git a/lib/ljax_rails/action_view_monkey.rb b/lib/ljax_rails/action_view_monkey.rb index abc1234..def5678 100644 --- a/lib/ljax_rails/action_view_monkey.rb +++ b/lib/ljax_rails/action_view_monkey.rb @@ -6,7 +6,7 @@ if options[:locals] && options[:locals].delete(:remote) partial = options.delete :partial url = options[:locals].delete :remote_url - id = SecureRandom.uuid + id = "ljax-#{SecureRandom.uuid}" context.flash[id] = partial loading = block.call if block
Mark as an ljax element
diff --git a/bin/generate/design.rb b/bin/generate/design.rb index abc1234..def5678 100644 --- a/bin/generate/design.rb +++ b/bin/generate/design.rb @@ -1,17 +1,17 @@ <% clock = aModuleInfo.clock_port.name rescue "YOUR_CLOCK_SIGNAL_HERE" %> # Simulates the design under test for one clock cycle. def DUT.cycle! - <%= clock %>.high! + <%= clock %>.t! advance_time - <%= clock %>.low! + <%= clock %>.f! advance_time end <% reset = aModuleInfo.reset_port.name rescue "YOUR_RESET_SIGNAL_HERE" %> # Brings the design under test into a blank state. def DUT.reset! - <%= reset %>.high! + <%= reset %>.t! cycle! - <%= reset %>.low! + <%= reset %>.f! end
Fix 'ArgumentError: "VpiHigh" is not a valid VPI property' This is done by replacing .high! and .low! wigh .t! and .f! in generated *_design.rb files. This only affects generation of files using "ruby-vpi generate".
diff --git a/lib/grape/kaminari.rb b/lib/grape/kaminari.rb index abc1234..def5678 100644 --- a/lib/grape/kaminari.rb +++ b/lib/grape/kaminari.rb @@ -21,8 +21,8 @@ def self.paginate(options = {}) options.reverse_merge!( - per_page: 10, - max_per_page: false + per_page: ::Kaminari.config.default_per_page || 10, + max_per_page: ::Kaminari.config.max_per_page ) params do optional :page, type: Integer, default: 1,
Use Kaminari's default config for (max_)per_page Use Kaminari's config which is generated from running `rails g kaminari:config`. You will still need to call `paginate` outside the `get`. I was looking for a way to do this automatically but couldn't think of an easy/quick implementation.
diff --git a/page_object_stubs.gemspec b/page_object_stubs.gemspec index abc1234..def5678 100644 --- a/page_object_stubs.gemspec +++ b/page_object_stubs.gemspec @@ -1,6 +1,8 @@ require_relative 'lib/page_object_stubs/version' Gem::Specification.new do |spec| + spec.required_ruby_version = '>= 1.9.3' + spec.name = 'page_object_stubs' spec.version = PageObjectStubs::VERSION spec.date = PageObjectStubs::DATE
Add required ruby version to gemspec
diff --git a/lib/chartkick.rb b/lib/chartkick.rb index abc1234..def5678 100644 --- a/lib/chartkick.rb +++ b/lib/chartkick.rb @@ -15,9 +15,21 @@ # use Enumerable so it can be called on arrays module Enumerable def chart_json - if is_a?(Hash) && (key = keys.first) && key.is_a?(Array) && key.size == 2 - group_by { |k, _v| k[0] }.map do |name, data| - {name: name, data: data.map { |k, v| [k[1], v] }} + if is_a?(Hash) + if (key = keys.first) && key.is_a?(Array) && key.size == 2 + group_by { |k, _v| k[0] }.map do |name, data| + {name: name, data: data.map { |k, v| [k[1], v] }} + end + else + to_a + end + elsif is_a?(Array) + map do |v| + if v[:data].is_a?(Hash) + v = v.dup + v[:data] = v[:data].to_a + end + v end else self
Use arrays instead of hashes to preserve order when converting to json
diff --git a/bootstrap-sass.gemspec b/bootstrap-sass.gemspec index abc1234..def5678 100644 --- a/bootstrap-sass.gemspec +++ b/bootstrap-sass.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = "bootstrap-sass" - s.version = '2.0.4.1' + s.version = '2.1.0.0' s.authors = ["Thomas McDonald"] s.email = 'tom@conceptcoding.co.uk' s.summary = "Twitter's Bootstrap, converted to Sass and ready to drop into Rails or Compass"
Bump working version to 2.1.0.0
diff --git a/breath_depth_search.rb b/breath_depth_search.rb index abc1234..def5678 100644 --- a/breath_depth_search.rb +++ b/breath_depth_search.rb @@ -46,3 +46,12 @@ end breath_first_search(root) + +def depth_first_search(node) + puts node.value + node.children.each do |child| + depth_first_search(child) + end +end + +depth_first_search(root)
Complete depth first search method
diff --git a/spec/examples_spec.rb b/spec/examples_spec.rb index abc1234..def5678 100644 --- a/spec/examples_spec.rb +++ b/spec/examples_spec.rb @@ -10,6 +10,10 @@ e '13483 74205 .@.@{.}{.@\%}W;\@*\/', 13483.lcm(74205) end + describe "Hailstone Sequence (Collatz Conjecture)" do + e '13[.{.1>}{{.2%}{.3*1+}{.2/}I}W]', [13, 40, 20, 10, 5, 16, 8, 4, 2, 1] + end + describe "Project Euler" do describe "Problem #6: Find the difference between the sum of the squares" + " of the first one hundred natural numbers and the square of the sum." do
Add Hailstone Sequence (Collatz Conjecture) example.
diff --git a/spec/patterns_spec.rb b/spec/patterns_spec.rb index abc1234..def5678 100644 --- a/spec/patterns_spec.rb +++ b/spec/patterns_spec.rb @@ -2,6 +2,12 @@ require 'patterns_module/patterns' describe Patterns do + + describe "constants" do + it "contains patterns as constants" do + expect(Patterns::PUNCTUATION).to eq([':', ',', '—', '!', '?', ';', '"']) + end + end describe "#basic" do it "should return a Regexp object" do
Write tests for constants in pattern module
diff --git a/spec/forecast_spec.rb b/spec/forecast_spec.rb index abc1234..def5678 100644 --- a/spec/forecast_spec.rb +++ b/spec/forecast_spec.rb @@ -20,6 +20,20 @@ FileUtils.remove_entry_secure(Forecaster.configuration.cache_dir) end + it "requires curl" do + curl_path = Forecaster.configuration.curl_path + out = `#{curl_path} --version` + + expect(out).to start_with("curl") + end + + it "requires wgrib2" do + wgrib2_path = Forecaster.configuration.wgrib2_path + out = `#{wgrib2_path} -version` + + expect(out).to start_with("v0.2") + end + it "fetches a forecast" do expect(@forecast.fetched?).to be false @forecast.fetch
Add tests for curl and wgrib2
diff --git a/spec/producer_spec.rb b/spec/producer_spec.rb index abc1234..def5678 100644 --- a/spec/producer_spec.rb +++ b/spec/producer_spec.rb @@ -6,6 +6,14 @@ let(:topic) { 'rspec' } let(:brokers) { 'localhost:1337' } + + context 'with a bad broker configuration' do + let(:brokers) { '' } + + it 'should raise an exception' do + producer.push('anything') + end + end describe '#push' do subject(:result) { producer.push(value) }
Add test case that exits the ruby interpreter (to be fixed real soon)
diff --git a/spec/requests_spec.rb b/spec/requests_spec.rb index abc1234..def5678 100644 --- a/spec/requests_spec.rb +++ b/spec/requests_spec.rb @@ -13,12 +13,12 @@ end it 'returns 200 status for post request' do - post '/', {} + post '/', {test: "value"} expect(last_response).to be_ok end it 'returns 200 status for put request' do - put '/', {} + put '/', {test: "value"} expect(last_response).to be_ok end
Add body to POST and PUT requests in spec.
diff --git a/test/no_visit_method_error_test.rb b/test/no_visit_method_error_test.rb index abc1234..def5678 100644 --- a/test/no_visit_method_error_test.rb +++ b/test/no_visit_method_error_test.rb @@ -1,11 +1,12 @@ require 'minitest/autorun' require_relative '../lib/eavi/no_visit_method_error' +require_relative 'fixtures' describe Eavi::NoVisitMethodError do it 'is catched as TypeError' do assert_raises TypeError do - raise Eavi::NoVisitMethodError.new(nil, nil, nil) + raise Eavi::NoVisitMethodError.new(Reader, 'string', String) end end end
Use fixtures in NoVisitMethodError tests
diff --git a/spec/support/seeds.rb b/spec/support/seeds.rb index abc1234..def5678 100644 --- a/spec/support/seeds.rb +++ b/spec/support/seeds.rb @@ -7,7 +7,7 @@ # leaves them there when deleting the rest (see spec/spec_helper.rb). # You can add more entries here if you need them for your tests. -if Spree::Country.where(nil).empty? +if Spree::Country.where(name: "Australia").empty? Spree::Country.create!({ "name" => "Australia", "iso3" => "AUS", "iso" => "AU", "iso_name" => "AUSTRALIA", "numcode" => "36" }) country = Spree::Country.find_by(name: 'Australia')
Fix order dependent reports spec Depending on the order of spec execution, it was possible that a factory created the default state "Alabama" with the default country "USA" instead of using the usual seed data of "Victoria" in "Australia". Some specs rely on "Victoria" though and we now make sure that it's created even if another spec created another country first.
diff --git a/lib/pagerduty/base.rb b/lib/pagerduty/base.rb index abc1234..def5678 100644 --- a/lib/pagerduty/base.rb +++ b/lib/pagerduty/base.rb @@ -22,7 +22,7 @@ output << "#{URI.encode(key.to_s)}=#{URI.encode(val)}" end end - uri.query = "?#{output.join("&")}" + uri.query = "#{output.join("&")}" req = Net::HTTP::Get.new(uri.request_uri) res = http.get(uri.to_s, {
Fix of nill values v2
diff --git a/sensu/plugins/check-os-api.rb b/sensu/plugins/check-os-api.rb index abc1234..def5678 100644 --- a/sensu/plugins/check-os-api.rb +++ b/sensu/plugins/check-os-api.rb @@ -36,6 +36,8 @@ "ceilometer meter-list -l 1" when "barbican" "openstack secret list -l 1" + when "aodh" + "ceilometer alarm-list" end end
Add aodh api service check
diff --git a/app/serializers/post_serializer.rb b/app/serializers/post_serializer.rb index abc1234..def5678 100644 --- a/app/serializers/post_serializer.rb +++ b/app/serializers/post_serializer.rb @@ -8,7 +8,7 @@ end def markdown_body - product_markdown(product, object.body.truncate(300)) + product_markdown(product, object.body) end def url
Stop truncating text posts in previews.
diff --git a/examples/init.rb b/examples/init.rb index abc1234..def5678 100644 --- a/examples/init.rb +++ b/examples/init.rb @@ -3,11 +3,9 @@ Moltin.configure do |config| config.client_id = 'YOUR_CLIENT_ID' config.client_secret = 'YOUR_CLIENT_SECRET' - config.base_url = 'https://api.yourdomain.com' + config.base_url = 'https://api.yourdomain.com' end -Moltin::Client.new({ - client_id: 'YOUR_CLIENT_ID', - client_secret: 'YOUR_CLIENT_SECRET', - base_url: 'https://api.yourdomain.com' -}) +Moltin::Client.new(client_id: 'YOUR_CLIENT_ID', + client_secret: 'YOUR_CLIENT_SECRET', + base_url: 'https://api.yourdomain.com')
Fix Rubocop offenses in examples/
diff --git a/app/views/api/skins/show.json.ruby b/app/views/api/skins/show.json.ruby index abc1234..def5678 100644 --- a/app/views/api/skins/show.json.ruby +++ b/app/views/api/skins/show.json.ruby @@ -6,6 +6,6 @@ }, token: @skin.token, properties: @skin.properties.in_chronological_order.map do |p| - {timestamp: p.created_at, key: p.key, value: p.value, type: p.type} + {timestamp: p.created_at.to_i, key: p.key, value: p.value, type: p.type} end }.to_json
Use epoch format for timestamp
diff --git a/heroku_dataclip/heroku_dataclip.rb b/heroku_dataclip/heroku_dataclip.rb index abc1234..def5678 100644 --- a/heroku_dataclip/heroku_dataclip.rb +++ b/heroku_dataclip/heroku_dataclip.rb @@ -1,18 +1,18 @@-class HerokuDataclipPlugin < Scout::Plugin +class HerokuDataclip < Scout::Plugin OPTIONS=<<-EOS dataclip_ids: - default: "" # a comma-delimited list of dataclip IDs (the string of letters from the url) which return ONLY ONE FIELD AND ROW each + default: "" + notes: A comma-delimited list of dataclip IDs (the string of letters from the url) which return ONLY ONE FIELD AND ROW each EOS def build_report dataclip_ids = option(:dataclip_ids) if dataclip_ids.nil? || dataclip_ids.empty? || dataclip_ids !~ /^[a-z,]+$/ - return error("Invalid or missing option \"dataclip_ids\"", - "The \"dataclip_ids\" option is required to be a comma-delimited list of dataclip IDs " + - "(the string of letters from the \"dataclips.heroku.com\" url) " + - "which return ONLY ONE FIELD AND ROW each " + - "(e.g. \"SELECT COUNT(*) AS total_count FROM tablename;\". " + - "Provided value was \"#{dataclip_ids}\"" + return error('Invalid or missing option "dataclip_ids"', + 'The "dataclip_ids\" option is required to be a comma-delimited list of dataclip IDs ' + + '(the string of letters from the "dataclips.heroku.com" url) ' + + 'which return ONLY ONE FIELD AND ROW each ' + + '(e.g. "SELECT COUNT(*) AS total_count FROM tablename;".' ) end dataclip_ids = dataclip_ids.split(',')
Fix minor formatting issues in HerokuDataclip
diff --git a/app/jobs/slack_invite_job.rb b/app/jobs/slack_invite_job.rb index abc1234..def5678 100644 --- a/app/jobs/slack_invite_job.rb +++ b/app/jobs/slack_invite_job.rb @@ -3,10 +3,11 @@ def perform(email) uri = URI.parse 'https://agileventures.slack.com/api/users.admin.invite' - Net::HTTP.post_form(uri, { + response = Net::HTTP.post_form(uri, { email: email, channels: 'C02G8J689,C0285CSUH,C02AA0ARR', token: Slack::AUTH_TOKEN }) + JSON.parse response.body end end
Return proper response from invite job
diff --git a/lib/tasks/feeder.rake b/lib/tasks/feeder.rake index abc1234..def5678 100644 --- a/lib/tasks/feeder.rake +++ b/lib/tasks/feeder.rake @@ -0,0 +1,8 @@+namespace :feeder do + desc "Publishes podcasts with episodes that are now released" + task :release_episodes => :environment do + puts "rake: release_episodes start" + ReleaseEpisodesJob.perform_now + puts "rake: release_episodes end" + end +end
Add a task to schedule for releasing episodes
diff --git a/app/models/challenge_post.rb b/app/models/challenge_post.rb index abc1234..def5678 100644 --- a/app/models/challenge_post.rb +++ b/app/models/challenge_post.rb @@ -44,7 +44,7 @@ def rank_score return unless persisted? - gravity = 1.8 # adjust as necessary + gravity = 2 # adjust as necessary hours_since_creation = (Time.current - created_at) / 1.hour (upvote_count + 1) / (hours_since_creation + 2)**gravity
Add more weight to time since submission
diff --git a/app/models/storytime/role.rb b/app/models/storytime/role.rb index abc1234..def5678 100644 --- a/app/models/storytime/role.rb +++ b/app/models/storytime/role.rb @@ -5,6 +5,14 @@ has_many :allowed_actions, through: :permissions, source: :action validates :name, uniqueness: true + + def editor? + name == "editor" + end + + def writer? + name == "writer" + end def admin? name == "admin"
Add editor and writer checks
diff --git a/app/models/yahoo/location.rb b/app/models/yahoo/location.rb index abc1234..def5678 100644 --- a/app/models/yahoo/location.rb +++ b/app/models/yahoo/location.rb @@ -11,6 +11,9 @@ def fullname "#{name}, #{admin1}, #{country}" + rescue TypeError => e + msg = "[Yahoo] Errored in request with #{@place} result: #{e.message}" + raise TypeError, msg end def name
Add some debugging for a Yahoo API crash
diff --git a/lib/utility/logger.rb b/lib/utility/logger.rb index abc1234..def5678 100644 --- a/lib/utility/logger.rb +++ b/lib/utility/logger.rb @@ -1,6 +1,8 @@+require 'digest/md5' class Logger + def initialize - @file = File.new("logs/#{Time.now.strftime('%Y-%m-%d')}.log", 'a') + @file = File.new("../logs/#{Time.now.strftime('%Y-%m-%d')} - #{Digest::MD5.hexdigest rand.to_s}.log", 'a') end def log(data)
Add unique IDs to log files
diff --git a/lib/wheelie/router.rb b/lib/wheelie/router.rb index abc1234..def5678 100644 --- a/lib/wheelie/router.rb +++ b/lib/wheelie/router.rb @@ -0,0 +1,41 @@+module Wheelie + class Router + + attr_accessor :model + + def initialize(model) + self.model = model + end + + def index + plural_path + end + + def new + "new_#{singular_path}" + end + + def edit(variable) + "edit_#{singular_path}(#{variable})" + end + + def show(variable) + "#{singular_path}(#{variable})" + end + + def destroy(variable) + "#{singular_path}(#{variable})" + end + + private + + def singular_path + "#{model.name.underscore}_path" + end + + def plural_path + "#{model.name.underscore.pluralize}_path" + end + + end +end
Create Wheelie::Routes, which offers path generation (e.g. users_path)
diff --git a/lib/wikitext/rails.rb b/lib/wikitext/rails.rb index abc1234..def5678 100644 --- a/lib/wikitext/rails.rb +++ b/lib/wikitext/rails.rb @@ -25,4 +25,10 @@ end end -ActionView::Base.register_template_handler :wikitext, Wikitext::TemplateHandler +if ActionView::Template.respond_to? :register_template_handler # Rails 2.1.0_RC1 and above + ActionView::Template.register_template_handler :wikitext, Wikitext::TemplateHandler +elsif ActionView::Base.respond_to? :register_template_handler # Rails 2.0.2 + ActionView::Base.register_template_handler :wikitext, Wikitext::TemplateHandler +else + raise "Incompatible Rails API version (can't find register_template_handler method)" +end
Update Rails adapater for 2.1.0 Fix breakage caused by API changes in Rails 2.1.0_RC1 while retaining compatibility with Rails 2.0.2. Signed-off-by: Wincent Colaiuta <c76ac2e9cd86441713c7dfae92c451f3e6d17fdc@wincent.com>
diff --git a/lib/outpost/model/authentication.rb b/lib/outpost/model/authentication.rb index abc1234..def5678 100644 --- a/lib/outpost/model/authentication.rb +++ b/lib/outpost/model/authentication.rb @@ -10,7 +10,6 @@ before_validation :generate_username, on: :create, if: -> { self.username.blank? } validates :name, presence: true - validates :email, presence: true validates :username, presence: true, uniqueness: true end @@ -20,12 +19,12 @@ end end - private - # Private: Generate a username based on real name # # Returns String of the username def generate_username + return nil if !self.name.present? + names = self.name.to_s.split base = (names.first.chars.first + names.last).downcase.gsub(/\W/, "") dirty_name = base
Return guard for generate_username; no need to validate e-mail presence
diff --git a/lib/yard/handlers/method_handler.rb b/lib/yard/handlers/method_handler.rb index abc1234..def5678 100644 --- a/lib/yard/handlers/method_handler.rb +++ b/lib/yard/handlers/method_handler.rb @@ -3,7 +3,7 @@ def process mscope = scope - meth = statement.tokens.to_s[/^def\s+([\s\w\:\.=<>\?^%\/\*]+)/, 1].gsub(/\s+/,'') + meth = statement.tokens.to_s[/^def\s+([\s\w\:\.=<>\?^%\/\*\[\]]+)/, 1].gsub(/\s+/,'') # Class method if prefixed by self(::|.) or Module(::|.) if meth =~ /(?:#{NSEP}|\.)([^#{NSEP}\.]+)$/
Add extra punctuation chars to method name
diff --git a/lib/appflux_ruby/bugflux_config.rb b/lib/appflux_ruby/bugflux_config.rb index abc1234..def5678 100644 --- a/lib/appflux_ruby/bugflux_config.rb +++ b/lib/appflux_ruby/bugflux_config.rb @@ -36,7 +36,7 @@ # This is the URL to API that accepts notifications generated by this gem. # Should be something like: /applications/<app_id>/notifications [POST] def host_name - 'http://appflux.io/exceptions' + 'https://appflux.io/exceptions' end end
Use https to report exceptions
diff --git a/lib/blockscore/errors/api_error.rb b/lib/blockscore/errors/api_error.rb index abc1234..def5678 100644 --- a/lib/blockscore/errors/api_error.rb +++ b/lib/blockscore/errors/api_error.rb @@ -19,9 +19,9 @@ def initialize(response) @http_body = JSON.parse(response.body, symbolize_names: true) - @message = error_advice[:message] + @message = error_advice.fetch(:message) @http_status = response.code - @error_type = error_advice[:type] + @error_type = error_advice.fetch(:type) end def to_s @@ -35,11 +35,11 @@ end def type_string - "(Type: #{error_type})" if error_type + "(Type: #{error_type})" end def status_string - "(Status: #{http_status})" if http_status + "(Status: #{http_status})" end end end
Upgrade to assume error elements are always present
diff --git a/lib/capistrano/tasks/database.rake b/lib/capistrano/tasks/database.rake index abc1234..def5678 100644 --- a/lib/capistrano/tasks/database.rake +++ b/lib/capistrano/tasks/database.rake @@ -1,3 +1,8 @@+def system_v(cmd) + info "Execute '#{cmd}'" + system cmd +end + desc 'Copy database from the server to your local database' task db2local: ['deploy:set_rails_env'] do on roles(:app) do @@ -21,18 +26,18 @@ credentials = [ "--user=#{ username }", - password ? "-p #{ password }" : '' + password && "--password=#{ password }" ].compact.join(' ') info 'Importing database' - system "gunzip -f #{ filename }" + system_v "gunzip -f #{ filename }" - system "mysqladmin -f #{ credentials } drop #{ database }" - system "mysqladmin #{ credentials } create #{ database }" - system "mysql #{ credentials } #{ database } < #{ filename.chomp('.gz') }" + system_v "mysqladmin -f #{ credentials } drop #{ database }" + system_v "mysqladmin #{ credentials } create #{ database }" + system_v "mysql #{ credentials } #{ database } < #{ filename.chomp('.gz') }" - system "rm #{ filename.chomp('.gz') }" + system_v "rm #{ filename.chomp('.gz') }" info 'Finished importing database' end
Make cap task db2local more robust and verbose - "--password=" instead of "-p " for compatibility with different mysql versions - log all locally executed commands
diff --git a/lib/govuk_seed_crawler/get_urls.rb b/lib/govuk_seed_crawler/get_urls.rb index abc1234..def5678 100644 --- a/lib/govuk_seed_crawler/get_urls.rb +++ b/lib/govuk_seed_crawler/get_urls.rb @@ -1,4 +1,4 @@-require 'govuk_mirrrorer/indexer' +require 'govuk_mirrorer/indexer' module GovukSeedCrawler class GetUrls
Fix typo when requiring GovukMirrorer::Indexer
diff --git a/lib/fastly/string.rb b/lib/fastly/string.rb index abc1234..def5678 100644 --- a/lib/fastly/string.rb +++ b/lib/fastly/string.rb @@ -1,7 +1,7 @@ # add an underscore method to String, so we can easily convert CamelCase to # camel_case for CacheSetting and RequestSetting objects. class String - if !instance_methods(false).include?(:underscore) + unless method_defined?(:underscore) def underscore gsub(/([^A-Z])([A-Z]+)/, '\1_\2').downcase end
Use slightly more straightforward method check
diff --git a/lib/keyed_archive.rb b/lib/keyed_archive.rb index abc1234..def5678 100644 --- a/lib/keyed_archive.rb +++ b/lib/keyed_archive.rb @@ -1,5 +1,18 @@+require 'cfpropertylist' + +require "keyed_archive/unpacked_objects" require "keyed_archive/version" -module KeyedArchive - # Your code goes here... +class KeyedArchive + attr_accessor :archiver, :objects, :top, :version + + def initialize(file) + plist = CFPropertyList::List.new(:file => file) + data = CFPropertyList.native_types(plist.value) + + @archiver = data['$archiver'] + @objects = data['$objects'] + @top = data['$top'] + @version = data['$version'] + end end
Add implementation for initializing a new keyed archive.
diff --git a/lib/metadata_hook.rb b/lib/metadata_hook.rb index abc1234..def5678 100644 --- a/lib/metadata_hook.rb +++ b/lib/metadata_hook.rb @@ -10,7 +10,13 @@ test_framework: { name: 'hspec', version: '2', - test_extension: 'hs' + test_extension: 'hs', + template: <<haskell +describe "{{ test_template_group_description }}" $ do + + it "{{ test_template_sample_description }}" $ do + True `shouldBe` True +haskell }} end end
Add hspec template to metadata
diff --git a/lib/request_rules.rb b/lib/request_rules.rb index abc1234..def5678 100644 --- a/lib/request_rules.rb +++ b/lib/request_rules.rb @@ -1,24 +1,74 @@+# assert_request Rails Plugin +# +# (c) Copyright 2007 by West Arete Computing, Inc. + module AssertRequest - # Holds the definition of the rules for a valid request - class RequestRules #:nodoc: - attr_reader :methods, :protocols, :params + + # This is the class that is supplied as an argument to the block in an + # assert_request call. You use it to describe the request methods, + # parameters, and protocols that are permitted for this request. + class RequestRules + attr_reader :methods, :protocols #:nodoc: - def initialize + def initialize #:nodoc: @methods = [] @protocols = [] @params = ParamRules.new end - # Add one or more request methods (symbol name, e.g. :get) to the list of - # permitted methods. By default, only GET requests are permitted. + # Used to describe the request methods that are permitted for this + # request. Takes a list of permitted request methods as symbols for its + # arguments. For example: + # + # assert_request do |r| + # r.method :put, :post + # end + # + # This declaration says that the request method must be either PUT or + # POST. + # + # If you don't include this call in your assert_request declaration, then + # assert_request will presume that only :get is allowed. + # def method(*methods) @methods = @methods.concat(methods).flatten end - # Add one or more request protocols (symbol name, e.g. :https) to the list - # of permitted protocols. By default, only http is permitted. + # Used to describe the protocols that are permitted for this + # request. Takes a list of permitted protocols as symbols for its + # arguments. For example: + # + # assert_request do |r| + # r.protocol :https + # end + # + # This declaration says that the request protocol must be via HTTPS. + # + # If you don't include this call in your assert_request declaration, then + # assert_request will presume that only :http is allowed. + # def protocol(*protocols) @protocols = @protocols.concat(protocols).flatten + end + + # Used to describe the params hash for this request. Most commonly, the + # must_have, may_have, and must_not_have methods are chained on to this + # method to describe the params structure. For example: + # + # assert_request do |r| + # r.params.must_have :id + # end + # + # For more details, see the methods that can be called on the result + # of this method: + # + # * ParamRules#must_have + # * ParamRules#may_have + # * ParamRules#is_a + # * ParamRules#must_not_have + # + def params + @params end end
Add full documentation for this file. git-svn-id: 36d0598828eae866924735253b485a592756576c@8095 da5c320b-a5ec-0310-b7f9-e4d854caa1e2
diff --git a/lib/slappy/client.rb b/lib/slappy/client.rb index abc1234..def5678 100644 --- a/lib/slappy/client.rb +++ b/lib/slappy/client.rb @@ -6,20 +6,23 @@ class Client def initialize Slack.configure { |config| config.token = ENV['SLACK_TOKEN'] } - @client = Slack.realtime @listeners = {} + end + + def client + @client ||= Slack.realtime end def start @listeners.each do |key, array| - @client.on key do |data| + client.on key do |data| array.each do |listener| event = Event.new(data, listener.pattern) if key == :message listener.call(event) end end end - @client.start + client.start end def hello(&block)
Use Slack Client to cache
diff --git a/lib/tasks/neo4j.rake b/lib/tasks/neo4j.rake index abc1234..def5678 100644 --- a/lib/tasks/neo4j.rake +++ b/lib/tasks/neo4j.rake @@ -0,0 +1,15 @@+namespace :envelopes do + desc 'Imports documents into Neo4j' + task :environment do + end + + desc 'Imports a JSON-LD file from Credential Registry.' + task :neo4j_import do + require File.expand_path('../../../config/environment', __FILE__) + require_relative '../../app/services/neo4j_import' + + Envelope.find_each do |envelope| + Neo4jImport.new(envelope.decoded_resource).create + end + end +end
Add rake task to import all envelopes into Neo4j
diff --git a/lib/jammit-s3.rb b/lib/jammit-s3.rb index abc1234..def5678 100644 --- a/lib/jammit-s3.rb +++ b/lib/jammit-s3.rb @@ -13,10 +13,11 @@ class JammitRailtie < Rails::Railtie initializer "set asset host and asset id" do config.after_initialize do + protocol = Jammit.configuration[:ssl] ? "https" : "http" if Jammit.configuration[:use_cloudfront] && Jammit.configuration[:cloudfront_domain].present? - asset_hostname = "http://#{Jammit.configuration[:cloudfront_domain]}" + asset_hostname = "#{protocol}://#{Jammit.configuration[:cloudfront_domain]}" else - asset_hostname = "http://#{Jammit.configuration[:s3_bucket]}.s3.amazonaws.com" + asset_hostname = "#{protocol}://#{Jammit.configuration[:s3_bucket]}.s3.amazonaws.com" end if Jammit.package_assets and asset_hostname.present?
Use https protocol when SSL is enabled.
diff --git a/lib/roxml/xml.rb b/lib/roxml/xml.rb index abc1234..def5678 100644 --- a/lib/roxml/xml.rb +++ b/lib/roxml/xml.rb @@ -4,6 +4,10 @@ require 'libxml' XML_PARSER = 'libxml' # :nodoc: rescue LoadError + warn <<WARNING +ROXML is unable to locate libxml on your system, and so is falling back to +the much slower REXML. It's best to check this out and get libxml working if possible. +WARNING XML_PARSER = 'rexml' # :nodoc: end end
Put out a warning if libxm lisn't found
diff --git a/spec/exlibris/aleph/config_spec.rb b/spec/exlibris/aleph/config_spec.rb index abc1234..def5678 100644 --- a/spec/exlibris/aleph/config_spec.rb +++ b/spec/exlibris/aleph/config_spec.rb @@ -1,6 +1,16 @@ module Exlibris module Aleph describe Config do + subject(:config) { Config } + describe '.admin_libraries' do + subject { Config.admin_libraries } + it { should be_an Array } + it 'should contain AdminLibraries' do + subject.each do |admin_library| + expect(admin_library).to be_an AdminLibrary + end + end + end end end end
Add an example to the Config spec
diff --git a/spec/factories/ci/job_artifacts.rb b/spec/factories/ci/job_artifacts.rb index abc1234..def5678 100644 --- a/spec/factories/ci/job_artifacts.rb +++ b/spec/factories/ci/job_artifacts.rb @@ -1,7 +1,4 @@-require "#{Rails.root}/spec/support/fixture_helpers.rb" - include ActionDispatch::TestProcess -include FixtureHelpers FactoryBot.define do factory :ci_job_artifact, class: Ci::JobArtifact do
Revert "Add FixtureHelpers for FactoryGirl" This reverts commit 3603e7c3a2cfd88e8441c5d76303645776349117.
diff --git a/spec/requests/static_pages_spec.rb b/spec/requests/static_pages_spec.rb index abc1234..def5678 100644 --- a/spec/requests/static_pages_spec.rb +++ b/spec/requests/static_pages_spec.rb @@ -25,6 +25,14 @@ it_should_behave_like 'all static pages' end + describe 'FAQ page' do + before { visit faq_path } + let(:heading) { 'Frequently Asked Questions' } + let(:page_title) { 'Frequently Asked Questions' } + + it_should_behave_like 'all static pages' + end + it 'should have the right links on the layout' do visit root_path click_link 'Contact' @@ -35,5 +43,9 @@ page.should have_selector('title', :text => full_title('Sign in')) click_link 'Articles' page.should have_selector('title', :text => full_title('Articles')) + click_link 'Events' + page.should have_selector('title', :text => full_title('Events')) + click_link 'FAQ' + page.should have_selector('title', :text => full_title('Frequently Asked Questions')) end -end+end
Add FAQ to request specs
diff --git a/spec/server/models/so_line_spec.rb b/spec/server/models/so_line_spec.rb index abc1234..def5678 100644 --- a/spec/server/models/so_line_spec.rb +++ b/spec/server/models/so_line_spec.rb @@ -2,9 +2,9 @@ class SoLineSpec < Skr::TestCase - it "can be instantiated" do - model = SoLine.new - model.must_be_instance_of(SoLine) + it "can load uom_choices" do + line = skr_so_line(:tiny_glove) + assert_equal ['PR', 'CS' ], line.uom_choices.pluck(:code) end end
Test that correct uoms are present
diff --git a/test/workbook/worksheet/auto_filter/tc_filter_column.rb b/test/workbook/worksheet/auto_filter/tc_filter_column.rb index abc1234..def5678 100644 --- a/test/workbook/worksheet/auto_filter/tc_filter_column.rb +++ b/test/workbook/worksheet/auto_filter/tc_filter_column.rb @@ -5,4 +5,9 @@ def setup end + + + def tc_do_it_later + assert true + end end
Add dummy test for filter column so it shuts up on 1.8.7
diff --git a/Casks/netnewswire.rb b/Casks/netnewswire.rb index abc1234..def5678 100644 --- a/Casks/netnewswire.rb +++ b/Casks/netnewswire.rb @@ -4,7 +4,7 @@ url "http://cdn.netnewswireapp.com/releases/NetNewsWire-#{version}.zip" appcast 'https://updates.blackpixel.com/updates?app=nnw', - :sha256 => '1ad06240a769ed639d5c0e0a9a139ef498915f17e3d069c90f7d5555f9954034' + :sha256 => '33564e80110c0e5bc562bf65f09046d95afcbab79d0e9c49617c2b8548a64cc2' homepage 'http://netnewswireapp.com/' license :commercial
Fix appcast hash for NewNewsWire
diff --git a/spree_embedded_videos.gemspec b/spree_embedded_videos.gemspec index abc1234..def5678 100644 --- a/spree_embedded_videos.gemspec +++ b/spree_embedded_videos.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = 'spree-embedded-videos' - s.version = '0.60.4' + s.version = '0.1.0' s.summary = 'A Spree extension that adds embedded videos to the product pages.' s.description = 'This extension uses oembed to support a variety of video services, such as YouTube, Vimeo, Brightcove, Viddler, Hulu, and more.' s.required_ruby_version = '>= 1.8.7'
Fix version number to be independent of spree version.
diff --git a/change-image/dell/barclamps/provisioner/chef/cookbooks/provisioner/recipes/base.rb b/change-image/dell/barclamps/provisioner/chef/cookbooks/provisioner/recipes/base.rb index abc1234..def5678 100644 --- a/change-image/dell/barclamps/provisioner/chef/cookbooks/provisioner/recipes/base.rb +++ b/change-image/dell/barclamps/provisioner/chef/cookbooks/provisioner/recipes/base.rb @@ -33,7 +33,10 @@ source "authorized_keys" end -cookbook_file "/etc/default/chef-client" do +config_file = "/etc/default/chef-client" +config_file = "/etc/sysconfig/chef-client" if node[:platform] =~ /^(redhat|centos)$/ + +cookbook_file config_file do owner "root" group "root" mode "0644"
Set the default parameters for chef-client on startup
diff --git a/spec/customization_engine_spec.rb b/spec/customization_engine_spec.rb index abc1234..def5678 100644 --- a/spec/customization_engine_spec.rb +++ b/spec/customization_engine_spec.rb @@ -8,21 +8,33 @@ let(:test_key) { I18n.t('account.show.change_credentials_link') } let!(:default_path) { I18n.load_path } + before do + reset_load_path_and_reload(default_path) + end + + after do + reset_load_path_and_reload(default_path) + end + it "loads custom and override original locales" do - I18n.load_path += Dir[Rails.root.join('spec', 'support', 'locales', 'custom', '*.{rb,yml}')] - I18n.reload! + increase_load_path_and_reload(Dir[Rails.root.join('spec', 'support', + 'locales', 'custom', '*.{rb,yml}')]) expect(test_key).to eq 'Overriden string with custom locales' end it "does not override original locales" do - I18n.load_path.delete_if {|item| item =~ /spec\/support\/locales\/custom/ } - I18n.load_path += Dir[Rails.root.join('spec', 'support', 'locales', '**', '*.{rb,yml}')] - I18n.reload! + increase_load_path_and_reload(Dir[Rails.root.join('spec', 'support', + 'locales', '**', '*.{rb,yml}')]) expect(test_key).to eq 'Not overriden string with custom locales' end - after do - I18n.load_path = default_path + def reset_load_path_and_reload(path) + I18n.load_path = path + I18n.reload! + end + + def increase_load_path_and_reload(path) + I18n.load_path += path I18n.reload! end
Make customization engine spec less prone to flaky failures
diff --git a/spec/heroku/command/stack_spec.rb b/spec/heroku/command/stack_spec.rb index abc1234..def5678 100644 --- a/spec/heroku/command/stack_spec.rb +++ b/spec/heroku/command/stack_spec.rb @@ -20,7 +20,7 @@ === example Available Stacks aspen-mri-1.8.6 bamboo-ree-1.8.7 - cedar (beta) + cedar-10 (beta) * bamboo-mri-1.9.2 STDOUT
Update spec to match the new behavior of stacks
diff --git a/api/spec/spec_helper.rb b/api/spec/spec_helper.rb index abc1234..def5678 100644 --- a/api/spec/spec_helper.rb +++ b/api/spec/spec_helper.rb @@ -11,7 +11,7 @@ require 'spree/core/testing_support/factories' RSpec.configure do |config| - config.backtrace_clean_patterns = [/gems\/activesupport/, /gems\/actionpack/] + config.backtrace_clean_patterns = [/gems\/activesupport/, /gems\/actionpack/, /gems\/rspec/] config.before(:suite) do DatabaseCleaner.strategy = :transaction DatabaseCleaner.clean_with(:truncation)
Remove AS + AP + RSpec stuff from API backtrace
diff --git a/lib/airbrake/cli/project_factory.rb b/lib/airbrake/cli/project_factory.rb index abc1234..def5678 100644 --- a/lib/airbrake/cli/project_factory.rb +++ b/lib/airbrake/cli/project_factory.rb @@ -2,13 +2,11 @@ # Responsible for creating projects when needed. # Creates them from XML received. class ProjectFactory + attr_reader :project, :projects + def initialize @project = Project.new @projects = [] - end - - def project - @project end def create_projects_from_xml(xml) @@ -32,8 +30,4 @@ @project = Project.new end end - - def projects - @projects - end end
Use getters instead of handwriten methods
diff --git a/csv_monster.gemspec b/csv_monster.gemspec index abc1234..def5678 100644 --- a/csv_monster.gemspec +++ b/csv_monster.gemspec @@ -14,6 +14,6 @@ gem.files = `git ls-files`.split($\) gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) - gem.add_development_dependency "rake" + gem.add_development_dependency "rake", ">= 12.3.3" gem.add_development_dependency "rspec", [">= 2"] end
Update sec vuln as per GH
diff --git a/app/models/gazetteer.rb b/app/models/gazetteer.rb index abc1234..def5678 100644 --- a/app/models/gazetteer.rb +++ b/app/models/gazetteer.rb @@ -4,13 +4,18 @@ return [] if attributes[:area].blank? stop_type_codes = StopType.codes_for_transport_mode(attributes[:transport_mode_id]) localities = Locality.find_all_with_descendants(attributes[:area]) - stops = Stop.find(:all, :conditions => ['locality_id in (?) and stop_type in (?)', - localities, stop_type_codes], :limit => limit) + query = 'locality_id in (?) and stop_type in (?)' + params = [localities, stop_type_codes] + if !attributes[:name].blank? + query += ' AND lower(common_name) like ?' + params << "%#{attributes[:name].downcase}%" + end + conditions = [query] + params + stops = Stop.find(:all, :conditions => conditions, :limit => limit) stops end def self.find_routes_from_attributes(attributes, limit=nil) - return [] if attributes[:area].blank? localities = Locality.find_all_with_descendants(attributes[:area]) routes = Route.find_all_by_transport_mode_id(attributes[:transport_mode_id], route_number=attributes[:route_number],
Use name when finding stops, don't require area for routes.
diff --git a/lib/grpc/kit/queue/worker/runner.rb b/lib/grpc/kit/queue/worker/runner.rb index abc1234..def5678 100644 --- a/lib/grpc/kit/queue/worker/runner.rb +++ b/lib/grpc/kit/queue/worker/runner.rb @@ -18,9 +18,7 @@ GRPC.logger.error("class #{@worker_class} does not exist") exit end - - subscriber = subscription.listen { |msg| worker.new(msg).call } - subscriber.start + subscription.listen { |msg| worker.new(msg).call } end private
Simplify GRPC::Kit::Queue::Worker::RunnerNERD_tree_1rungit push origin improvement/update-dependencies
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -24,9 +24,12 @@ # from config/locales/*.rb,yml are auto loaded. # - # config.i18n.default_locale = :de + config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')] + + config.i18n.default_locale = :en + config.i18n.fallbacks = [:en] # Filter sensitive parameters out of logs config.filter_parameters << :password
Set :en as the default and fallback language
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -24,5 +24,6 @@ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de + config.assets.initialize_on_precompile = false end end
Fix for assets precompile for engines
diff --git a/config/application.rb b/config/application.rb index abc1234..def5678 100644 --- a/config/application.rb +++ b/config/application.rb @@ -6,6 +6,7 @@ require 'action_controller/railtie' require 'action_view/railtie' require 'rails/test_unit/railtie' +require 'restclient/components' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. @@ -29,5 +30,11 @@ # Logging config.logger = Logging.logger[self] RestClient.log = Logging.logger['RestClient'] + + # Enable HTTP cache + RestClient.enable Rack::Cache, + :verbose => true, + :default_ttl => 60 * 30, + :private_headers => ['Authorization', 'Cookie', 'X-Api-Key'] end end
Implement HTTP API proxy request caching
diff --git a/lib/rakuten_web_service/response.rb b/lib/rakuten_web_service/response.rb index abc1234..def5678 100644 --- a/lib/rakuten_web_service/response.rb +++ b/lib/rakuten_web_service/response.rb @@ -11,22 +11,21 @@ @json[key] end - def []=(key, value) - @json[key] = value - end - def each resources.each do |resource| yield resource end end - def page - @json['page'] + %w[count hits page first last carrier pageCount].each do |name| + method_name = name.gsub(/([a-z])([A-Z]{1})/) { "#{$1}_#{$2.downcase}" } + define_method method_name do + self[name] + end end def resources - @resource_class.parse_response(@json) + @resources ||= @resource_class.parse_response(@json) end def has_next_page? @@ -34,7 +33,7 @@ end def last_page? - page >= @json['pageCount'] + page >= page_count end end end
Define methods of RWS::Response to fetch overall information
diff --git a/appsignal-mongo.gemspec b/appsignal-mongo.gemspec index abc1234..def5678 100644 --- a/appsignal-mongo.gemspec +++ b/appsignal-mongo.gemspec @@ -13,7 +13,7 @@ s.summary = 'Add instrument calls to mongodb queries '\ 'made with mongo. For use with Appsignal.' s.description = 'Wrap all mongo queries with'\ - 'ActiveSupport::Notifications.instrument calls.'\ + 'ActiveSupport::Notifications.instrument calls. '\ 'For use with Appsignal.' s.files = Dir.glob('lib/**/*') + %w(README.md)
Fix typo in the gem description
diff --git a/library/tempfile/initialize_spec.rb b/library/tempfile/initialize_spec.rb index abc1234..def5678 100644 --- a/library/tempfile/initialize_spec.rb +++ b/library/tempfile/initialize_spec.rb @@ -5,7 +5,7 @@ before(:each) do @tempfile = Tempfile.allocate end - + after(:each) do @tempfile.close end @@ -16,4 +16,9 @@ @tempfile.path.should =~ /^#{tmp("")}/ @tempfile.path.should include("basename") end + + it "sets the permisssions on the tempfile to 0600" do + @tempfile.send(:initialize, "basename", tmp("")) + File.stat(@tempfile.path).mode.should == 0100600 + end end
Add spec ensuring tempfile gets created w/ 0600 (kinda important)
diff --git a/irb.d/looksee.rb b/irb.d/looksee.rb index abc1234..def5678 100644 --- a/irb.d/looksee.rb +++ b/irb.d/looksee.rb @@ -1,7 +1,10 @@ #!/usr/bin/env ruby # -*- ruby -*- -if defined? lp - alias :m :lp +# +# Alias Looksee's :ls method to :m +# +if defined? ls + alias :m :ls usage "m", "Lists methods defined on the argument object and their sources" -end+end
Update to work with Looksee 1.0.2
diff --git a/plugins/provisioners/shell/config.rb b/plugins/provisioners/shell/config.rb index abc1234..def5678 100644 --- a/plugins/provisioners/shell/config.rb +++ b/plugins/provisioners/shell/config.rb @@ -10,32 +10,36 @@ @upload_path = "/tmp/vagrant-shell" end - def validate(env, errors) + def validate(machine) + errors = [] + # Validate that the parameters are properly set if path && inline - errors.add(I18n.t("vagrant.provisioners.shell.path_and_inline_set")) + errors << I18n.t("vagrant.provisioners.shell.path_and_inline_set") elsif !path && !inline - errors.add(I18n.t("vagrant.provisioners.shell.no_path_or_inline")) + errors << I18n.t("vagrant.provisioners.shell.no_path_or_inline") end # Validate the existence of a script to upload if path - expanded_path = Pathname.new(path).expand_path(env.root_path) + expanded_path = Pathname.new(path).expand_path(machine.env.root_path) if !expanded_path.file? - errors.add(I18n.t("vagrant.provisioners.shell.path_invalid", - :path => expanded_path)) + errors << I18n.t("vagrant.provisioners.shell.path_invalid", + :path => expanded_path) end end # There needs to be a path to upload the script to if !upload_path - errors.add(I18n.t("vagrant.provisioners.shell.upload_path_not_set")) + errors << I18n.t("vagrant.provisioners.shell.upload_path_not_set") end # If there are args and its not a string, that is a problem if args && !args.is_a?(String) - errors.add(I18n.t("vagrant.provisioners.shell.args_not_string")) + errors << I18n.t("vagrant.provisioners.shell.args_not_string") end + + { "shell provisioner" => errors } end end end
Update shell provisioner to latest validation api
diff --git a/lib/glimpse/views/active_record.rb b/lib/glimpse/views/active_record.rb index abc1234..def5678 100644 --- a/lib/glimpse/views/active_record.rb +++ b/lib/glimpse/views/active_record.rb @@ -21,7 +21,7 @@ end def formatted_duration - "%.2f" % (duration * 1000) + "%.2fms" % (duration * 1000) end def results
Add ms after duration for ActiveRecord
diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index abc1234..def5678 100644 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -3,9 +3,9 @@ config.fog_credentials = { provider: 'AWS', host: 's3.amazonaws.com', - endpoint: 'http://juntoscomvc.s3.amazonaws.com', aws_access_key_id: CatarseSettings.get_without_cache(:aws_access_key), - aws_secret_access_key: CatarseSettings.get_without_cache(:aws_secret_key) + aws_secret_access_key: CatarseSettings.get_without_cache(:aws_secret_key), + region: 'sa-east-1' } config.fog_directory = CatarseSettings.get_without_cache(:aws_bucket) config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional, defaults to {}
Fix the aws bucket region
diff --git a/lib/padrino-contrib/auto_locale.rb b/lib/padrino-contrib/auto_locale.rb index abc1234..def5678 100644 --- a/lib/padrino-contrib/auto_locale.rb +++ b/lib/padrino-contrib/auto_locale.rb @@ -24,14 +24,20 @@ def switch_to_lang(lang) request.path_info.sub(/\/#{I18n.locale}/, "/#{lang}") if options.locales.include?(lang) end + + def url(*args) + "/#{I18n.locale}#{super}" + end end # Helpers def self.registered(app) app.helpers Padrino::Contrib::AutoLocale::Helpers app.set :locales, [:en] app.before do - if request.path_info =~ /^\/(#{options.locales.join('|')})\/?/ + if request.path_info =~ /^\/(#{options.locales.join('|')})(?=\/|$)/ I18n.locale = $1.to_sym + request.path_info.sub!(/^\/(#{$1})\/?/) { $2 || '' } + request.path_info.replace('/') if request.path_info.empty? else I18n.locale = options.locales.first end
Make AutoLocale transparently prepend/strip locale * AutoLocale should alter request.path_info, so our controllers do not need to handle locale path parts in their mappings. * Conversely, the URL helpers should prepend the locale to the path. * Solution inspired by Sven Fuch's excellent Routing Filter for Rails: http://github.com/svenfuchs/routing-filter (and our matching RegEx adjusted, based on his work). Signed-off-by: Alex Coles <60c6d277a8bd81de7fdde19201bf9c58a3df08f4@alexcolesportfolio.com>
diff --git a/db/migrate/20170614135807_change_partner_nullables.rb b/db/migrate/20170614135807_change_partner_nullables.rb index abc1234..def5678 100644 --- a/db/migrate/20170614135807_change_partner_nullables.rb +++ b/db/migrate/20170614135807_change_partner_nullables.rb @@ -1,6 +1,12 @@ class ChangePartnerNullables < ActiveRecord::Migration - def change + def self.up + Partner.where(name: nil).each { |partner| partner.update(name: 'Event Partner') } change_column_null :partners, :name, false change_column_null :partners, :banner_link, true end + + def self.down + change_column_null :partners, :name, true + change_column_null :partners, :banner_link, false + end end
Change migration to make possible to move forward if Partner records exist without names.
diff --git a/lib/rubella/weighting/per_value.rb b/lib/rubella/weighting/per_value.rb index abc1234..def5678 100644 --- a/lib/rubella/weighting/per_value.rb +++ b/lib/rubella/weighting/per_value.rb @@ -2,21 +2,49 @@ module Weighting # Gets an input object and prepares the data for the output. - # - # This class weights the input data per value. - # Which means, that all values together make 100%. So you need all values at - # the same level, to get the maximum color intensity. - # - # The output is an Array which contains again an Array per every point of - # time, which contains the load in the given steps (default is 10% per step) - # and the value in percentage for the representative olor intensity. - # class PerValue + attr_reader :buckets + # : steps - def initialize + + # buckets must be one of 1, 2, 5, 10, 20, 50 default is 10 + def initialize(buckets = 10) + self.buckets = buckets end + def parse(data) + # no data, no work + return [] if data.length == 0 + + # total amount of cores + total_amount = data[0].length + # TODO check somewhere, if every dataset has the same amount of cores + + # prepare data + data_list = Array.new() + + data.each do |cores| + # every 10 load percent one heatpoint + i = 0 + data_list << Array.new(buckets) do + amount = cores.select { |core| core >= i and core < (i+@steps)}.length + i = i + @steps + amount/total_amount + end + end + + data_list + end + def buckets= buckets + # Must be divideable by 100 + if([1, 2, 5, 10, 20, 50].index(buckets) == nil) + raise ArgumentError, "Amount of buckets must be 1, 2, 5, 10, 20 or 50" + end + + @steps = buckets/100 + @buckets = buckets + end end
Add source code to Weighting::PerValue Runs, but I didn't test it so far.
diff --git a/lib/source_finder/option_parser.rb b/lib/source_finder/option_parser.rb index abc1234..def5678 100644 --- a/lib/source_finder/option_parser.rb +++ b/lib/source_finder/option_parser.rb @@ -0,0 +1,38 @@+module SourceFinder + # Brings in command-line options to configure SourceFinder--usable + # with the ruby OptionParser class, brought in with 'require + # "optparse"' + class OptionParser + def fresh_globber + SourceFinder::SourceFileGlobber.new + end + + def default_source_files_glob + fresh_globber.source_files_glob + end + + def default_source_files_exclude_glob + fresh_globber.source_files_exclude_glob + end + + def add_glob_option(opts, options) + opts.on('-g glob here', '--glob', + 'Which files to parse - ' \ + "default is #{default_source_files_glob}") do |v| + options[:glob] = v + end + end + + def add_exclude_glob_option(opts, options) + opts.on('-e glob here', '--exclude-glob', + 'Files to exclude - default is none') do |v| + options[:exclude] = v + end + end + + def add_options(opts, options) + add_glob_option(opts, options) + add_exclude_glob_option(opts, options) + end + end +end
Add space for common command-line option parser
diff --git a/lib/tag_sidebar/lib/tag_sidebar.rb b/lib/tag_sidebar/lib/tag_sidebar.rb index abc1234..def5678 100644 --- a/lib/tag_sidebar/lib/tag_sidebar.rb +++ b/lib/tag_sidebar/lib/tag_sidebar.rb @@ -5,12 +5,13 @@ setting :maximum_tags, 20 def tags - @tags ||= Tag.find_all_with_article_counters(maximum_tags.to_i).sort_by {|t| t.name} + @tags ||= Tag.find_all_with_article_counters. + take(maximum_tags.to_i).sort_by {|t| t.name} end def sizes return @sizes if @sizes - total = @tags.inject(0) {|total, tag| total + tag.article_counter } + total = @tags.inject(0) {|sum, tag| sum + tag.article_counter } average = total.to_f / @tags.size.to_f @sizes = @tags.inject({}) do |h,tag| size = tag.article_counter.to_f / average
Fix call to find_all_with_article_counters in tag sidebar
diff --git a/app/jobs/merge_variants.rb b/app/jobs/merge_variants.rb index abc1234..def5678 100644 --- a/app/jobs/merge_variants.rb +++ b/app/jobs/merge_variants.rb @@ -8,6 +8,7 @@ ActiveRecord::Base.transaction do transfer_evidence_items remove_suggested_changes + transfer_flags transfer_subcriptions remove_variant end @@ -25,6 +26,16 @@ removed_variant.suggested_changes.each do |sc| sc.delete sc.save + end + end + + def transfer_flags + removed_variant.flags.each do |f| + comment = f.comments.first + comment.comment = "(Merged from #{removed_variant.display_name}) #{f.comments.first.comment}" + comment.save + f.flaggable = remaining_variant + f.save end end
Add handling of flags during variant merging
diff --git a/app/mailers/sync_mailer.rb b/app/mailers/sync_mailer.rb index abc1234..def5678 100644 --- a/app/mailers/sync_mailer.rb +++ b/app/mailers/sync_mailer.rb @@ -1,5 +1,5 @@ class SyncMailer < ActionMailer::Base - default from: "DO NOT REPLY <inside-government@digital.cabinet-office.gov.uk>" + default from: "DO NOT REPLY <trade-tariff-alerts@digital.cabinet-office.gov.uk>" def admin_notification(admin_email, failed_file_path, exception) @exception = exception
Use trade-tariff-alerts@digital.cabinet-office.gov.uk as support email HMRC will also need to be notified that an error has occured
diff --git a/app/models/access_token.rb b/app/models/access_token.rb index abc1234..def5678 100644 --- a/app/models/access_token.rb +++ b/app/models/access_token.rb @@ -26,10 +26,10 @@ def self.build_for(ontology_version) repository = ontology_version.repository - AccessToken.new( - {repository: repository, - expiration: fresh_expiration_date, - token: generate_token_string(ontology_version, repository)}, + AccessToken.new({ + repository: repository, + expiration: fresh_expiration_date, + token: generate_token_string(ontology_version, repository)}, {without_protection: true}) end
Put `{` on the same line as `(`.