diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/config/initializers/fast_gettext.rb b/config/initializers/fast_gettext.rb index abc1234..def5678 100644 --- a/config/initializers/fast_gettext.rb +++ b/config/initializers/fast_gettext.rb @@ -5,6 +5,9 @@ # trying to debug something other than their parser, we need to # temporarily force it off while we load stuff. Vmdb::FastGettextHelper.register_locales + gettext_options = %w(--sort-by-msgid --location --no-wrap) + Rails.application.config.gettext_i18n_rails.msgmerge = gettext_options + Rails.application.config.gettext_i18n_rails.xgettext = gettext_options << "--add-comments=TRANSLATORS" ensure $DEBUG = old_debug end
Add comments and location comments into gettext catalogs This change adds the following into gettext catalogs: 1. comments showing location of strings in source .rb / .haml files 2. custom comments / hints for translators (# TRANSLATORS) Resolves: #1249
diff --git a/config/software/openstack-common.rb b/config/software/openstack-common.rb index abc1234..def5678 100644 --- a/config/software/openstack-common.rb +++ b/config/software/openstack-common.rb @@ -24,6 +24,7 @@ dependency "lxml" dependency "libreadline" dependency "libyaml" +dependency "libffi" dependency "libmysql" dependency "libsqlite"
Make sure we are including libffi Looks like libffi was missing from the list of openstack-common dependencies.
diff --git a/spec/requests/user/registrations_controller_spec.rb b/spec/requests/user/registrations_controller_spec.rb index abc1234..def5678 100644 --- a/spec/requests/user/registrations_controller_spec.rb +++ b/spec/requests/user/registrations_controller_spec.rb @@ -0,0 +1,25 @@+# frozen_string_literal: true + +require "rails_helper" + +RSpec.describe User::RegistrationsController, type: :controller do + let(:user) { FactoryBot.create(:user, **user_params) } + + describe "DELETE #destroy" do + subject { delete :destroy } + + context "user has an export pending" do + let(:user_params) { { export_processing: true } } + + before do + @request.env["devise.mapping"] = Devise.mappings[:user] # so that devise knows that we're testing the user controller + sign_in(user) + end + + it "doesn't allow for the account to be deleted" do + subject + expect(flash[:error]).to eq(I18n.t("user.registrations.destroy.export_pending")) + end + end + end +end
Add test for trying to delete account while an export is pending
diff --git a/pdf-toolkit.gemspec b/pdf-toolkit.gemspec index abc1234..def5678 100644 --- a/pdf-toolkit.gemspec +++ b/pdf-toolkit.gemspec @@ -10,8 +10,9 @@ s.description = 'PDF::Toolkit provides a simple interface for querying and unpdation PDF metadata like the document Author and Title.' s.version = PDF::Toolkit::VERSION - s.author = 'Tim Pope' - s.email = 'ruby@tp0pe.inf0'.gsub(/0/,'o') + s.authors = ['Tim Pope', 'Bernard Lambeau'] + s.email = ['ruby@tp0pe.inf0'.gsub(/0/,'o'), "blambeau@gmail.com"] + s.rubyforge_project = 'pdf-toolkit' s.homepage = "http://pdf-toolkit.rubyforge.org" @@ -20,6 +21,6 @@ s.files = [ "Rakefile", "README", "pdf-toolkit.gemspec" ] s.files = s.files + Dir.glob( "lib/**/*.rb" ) - s.files = s.files + Dir.glob( "test/**/*" ).reject { |item| item.include?( "\.svn" ) } + s.files = s.files + Dir.glob( "test/**/*" ) end
Add myself to the authors in gemspec
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 @@ -27,6 +27,6 @@ end def add_avatar_url - self.avatar_url = "/images/default_avatar.jpg" + self.avatar_url = "/images/default_avatar.jpg" if self.avatar_url.nil? end end
Update add_avatar_url model in User to only assign default avatar if avatar_url is nil
diff --git a/test/integration/ec2/serverspec/default_spec.rb b/test/integration/ec2/serverspec/default_spec.rb index abc1234..def5678 100644 --- a/test/integration/ec2/serverspec/default_spec.rb +++ b/test/integration/ec2/serverspec/default_spec.rb @@ -17,4 +17,8 @@ end end end + + describe file('/mnt') do + it { is_expected.to_not be_mounted } + end end
Add check to ensure that /mnt is not mounted
diff --git a/Library/Homebrew/rubocops/cask/url_legacy_comma_separators.rb b/Library/Homebrew/rubocops/cask/url_legacy_comma_separators.rb index abc1234..def5678 100644 --- a/Library/Homebrew/rubocops/cask/url_legacy_comma_separators.rb +++ b/Library/Homebrew/rubocops/cask/url_legacy_comma_separators.rb @@ -14,7 +14,9 @@ MSG_CSV = "Use 'version.csv.first' instead of 'version.before_comma' and 'version.csv.second' instead of 'version.after_comma'." - def on_url_stanza(stanza) + def on_url_stanza(stanza) + return if stanza.stanza_node.type == :block + url_node = stanza.stanza_node.first_argument legacy_comma_separator_pattern = /version.(before|after)_comma/
Add check for url :block
diff --git a/spec/acceptance/steps/admin_user_management_steps.rb b/spec/acceptance/steps/admin_user_management_steps.rb index abc1234..def5678 100644 --- a/spec/acceptance/steps/admin_user_management_steps.rb +++ b/spec/acceptance/steps/admin_user_management_steps.rb @@ -7,7 +7,7 @@ click_link 'New user' fill_in 'Email', with: 'user@example.com' - select 'Regular', from: 'Role' + select 'Regular', from: "Account type" fill_in 'Password', with: "my98ssdkjv9823kds=2" fill_in 'Password confirmation', with: "my98ssdkjv9823kds=2"
Fix admin user role spec
diff --git a/Formula/asterisk.rb b/Formula/asterisk.rb index abc1234..def5678 100644 --- a/Formula/asterisk.rb +++ b/Formula/asterisk.rb @@ -1,40 +1,20 @@ require 'formula' class Asterisk < Formula - url 'http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.6.1.6.tar.gz' + url 'http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.8.3.2.tar.gz' homepage 'http://www.asterisk.org/' - md5 '63a928373e741524aac09d8c078df7d5' + md5 '0bee03f4498a6081146a579b51130633' skip_clean :all # Or modules won't load - # Use cURL instead of wget - def patches; DATA; end + def options + [['--with-sample-config', "Install the sample config files. NOTE. Without this, you won't have any config file."]] + end def install - configure_flags = [ "--prefix=#{prefix}", "--localstatedir=#{var}", "--sysconfdir=#{etc}" ] - # Avoid "src/add.c:1: error: CPU you selected does not support x86-64 instruction set" - configure_flags << "--host=x86_64-darwin" if MacOS.prefer_64_bit? - system "./configure", *configure_flags + system "./configure", "--prefix=#{prefix}", "--localstatedir=#{var}", "--sysconfdir=#{etc}" system "make" system "make install" - (etc+"asterisk").mkpath + system "make samples" if ARGV.include? '--with-sample-config' end end - - -__END__ ---- a/sounds/Makefile 2009-10-13 02:12:08.000000000 +0300 -+++ b/sounds/Makefile 2009-10-13 02:15:11.000000000 +0300 -@@ -53,10 +53,8 @@ - MM:=$(subst -SLN16,-sln16,$(MM)) - MOH:=$(MM:MOH-%=asterisk-moh-%.tar.gz) - MOH_TAGS:=$(MM:MOH-%=$(MOH_DIR)/.asterisk-moh-%) --# If "fetch" is used, --continue is not a valid option. --ifeq ($(WGET),wget) --WGET_ARGS:=--continue --endif -+DOWNLOAD:=curl -+WGET_ARGS:=-O - - all: $(CORE_SOUNDS) $(EXTRA_SOUNDS) $(MOH) -
Update Asterisk from 1.6.1.6 to 1.8.3.2. * Added the '--with-sample-config' option. This will generate the sample Asterisk config files in /usr/local/etc/asterisk. It creates backups of any existing files first. * Removed the patch that used curl instead of wget to download the sound files. This doesn't appear to be required any longer (at least, the sound files download correctly without it, where they didn't previously). * Removed the '--host=x86_64-darwin' configure switch. Supplying this switch to configure results in the warning, 'configure: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used.', and building without the switch appears to result in the correct architecture being targeted. * Removed the manual creation of /usr/local/etc/asterisk. This directory is created automatically. Signed-off-by: Adam Vandenberg <34c2b6407fd5a10249a15d699d40f9ed1782e98c@gmail.com>
diff --git a/lib/sync_checker/formats/document_collection_check.rb b/lib/sync_checker/formats/document_collection_check.rb index abc1234..def5678 100644 --- a/lib/sync_checker/formats/document_collection_check.rb +++ b/lib/sync_checker/formats/document_collection_check.rb @@ -6,7 +6,7 @@ end def rendering_app - Whitehall::RenderingApp::WHITEHALL_FRONTEND + Whitehall::RenderingApp::GOVERNMENT_FRONTEND end def checks_for_live(locale)
Update Document Collection sync check As part of the Deploy 1 tast for Document Collection, the sync check should now expect `government-frontend` to be the rendering app
diff --git a/lib/generators/sts_salesforce/install/install_generator.rb b/lib/generators/sts_salesforce/install/install_generator.rb index abc1234..def5678 100644 --- a/lib/generators/sts_salesforce/install/install_generator.rb +++ b/lib/generators/sts_salesforce/install/install_generator.rb @@ -10,15 +10,6 @@ source_root File.expand_path('../templates', __FILE__ ) desc "add migrations" - - def self.next_migration_number(path) - unless @prev_migration_nr - @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i - else - @prev_migration_nr += 1 - end - @prev_migration_nr.to_s - end def copy_migrations copy_migration "create_salesforce_orgs"
Remove next_migration since using ActiveRecord
diff --git a/test/factories/uploads.rb b/test/factories/uploads.rb index abc1234..def5678 100644 --- a/test/factories/uploads.rb +++ b/test/factories/uploads.rb @@ -1,16 +1,23 @@ FactoryGirl.define do factory :upload, class: "S3Relay::Upload" do - uuid SecureRandom.uuid + uuid { SecureRandom.uuid } + end + + factory :file_upload, parent: :upload do filename "cat.png" content_type "image/png" upload_type "FileUpload" end factory :icon_upload, parent: :upload do - upload_type "IconUpload" + filename "cat.png" + content_type "image/png" + upload_type "IconUpload" end factory :photo_upload, parent: :upload do - upload_type "PhotoUpload" + filename "cat.png" + content_type "image/png" + upload_type "PhotoUpload" end end
Fix upload factory so we don't get same UUID for every test * Add `file_upload` factory
diff --git a/test/lib/ext_test_unit.rb b/test/lib/ext_test_unit.rb index abc1234..def5678 100644 --- a/test/lib/ext_test_unit.rb +++ b/test/lib/ext_test_unit.rb @@ -26,5 +26,8 @@ def assert_true(object, message="") assert_equal(true, object, message) end + def assert_nil(object, message="") + assert_equal(nil, object, message) + end end
Add assert_nil extension to Test::Unit.
diff --git a/spec/lib/asset_pipeline/processors/js_hint_spec.rb b/spec/lib/asset_pipeline/processors/js_hint_spec.rb index abc1234..def5678 100644 --- a/spec/lib/asset_pipeline/processors/js_hint_spec.rb +++ b/spec/lib/asset_pipeline/processors/js_hint_spec.rb @@ -5,6 +5,7 @@ module Processors describe JsHint do describe '#evaluate' do + let(:jshint_options) { { unused: true } } let(:context) { double } let(:locals) { double } @@ -13,6 +14,7 @@ before do allow_any_instance_of(described_class).to receive(:initialize) allow(subject).to receive(:data).and_return(javascript) + allow(subject).to receive(:options).and_return(jshint_options) end context 'when javascript is valid' do
Remove test dependency on external jshintrc.
diff --git a/spec/features/command_line_interface_spec.rb b/spec/features/command_line_interface_spec.rb index abc1234..def5678 100644 --- a/spec/features/command_line_interface_spec.rb +++ b/spec/features/command_line_interface_spec.rb @@ -1,6 +1,6 @@ require "spec_helper" -RSpec.shared_examples "help information" do |command:| +RSpec.shared_examples "help information" do |command| it "prints help information" do output = `#{command}` @@ -10,12 +10,12 @@ RSpec.describe "command line interface" do describe "help" do - it_behaves_like "help information", command: "bin/pakyow --help" - it_behaves_like "help information", command: "bin/pakyow -h" + it_behaves_like "help information", "bin/pakyow --help" + it_behaves_like "help information", "bin/pakyow -h" %w(console new server).each do |command| describe "#{command} help" do - it_behaves_like "help information", command: "bin/pakyow help #{command}" + it_behaves_like "help information", "bin/pakyow help #{command}" end end end
Refactor spec to work with Ruby 2.0 * Required kwargs weren't introduced until 2.1 * This doesn't read quite as well IMO, but it's test code so nbd.
diff --git a/db/migrate/20140327214000_create_customer_project.rb b/db/migrate/20140327214000_create_customer_project.rb index abc1234..def5678 100644 --- a/db/migrate/20140327214000_create_customer_project.rb +++ b/db/migrate/20140327214000_create_customer_project.rb @@ -4,7 +4,7 @@ def change create_skr_table :customer_projects do |t| t.skr_code_identifier - t.text :description, :po_num, null: false + t.text :description, :po_num t.skr_reference :sku, single: true t.skr_reference :customer, single: true t.jsonb :rates
Allow non-mandatory fields to be nil
diff --git a/providers/update.rb b/providers/update.rb index abc1234..def5678 100644 --- a/providers/update.rb +++ b/providers/update.rb @@ -9,9 +9,12 @@ action :update do index = ::File.expand_path("~#{ new_resource.user }/.cabal/packages/hackage.haskell.org/00-index.cache") - age = (Time.now - ::File.mtime(index)) / 60 - if age > new_resource.cache_for + def age + (Time.now - ::File.mtime(index)) / 60 + end + + if !::File.exists?(index) || age > new_resource.cache_for converge_by("cabal update #{ new_resource.user }") do execute "su - #{ new_resource.user } -c 'cabal update'" end
Check if index file exists before calling mtime. Closes #1.
diff --git a/test/support/rails_app.rb b/test/support/rails_app.rb index abc1234..def5678 100644 --- a/test/support/rails_app.rb +++ b/test/support/rails_app.rb @@ -1,3 +1,5 @@+require 'yaml' + class RailsApp < Rails::Application end
Add yuml dependency for dev mode
diff --git a/expires.gemspec b/expires.gemspec index abc1234..def5678 100644 --- a/expires.gemspec +++ b/expires.gemspec @@ -18,10 +18,10 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] + spec.add_dependency 'color_print' + spec.add_dependency 'sqlite3' + spec.add_development_dependency "bundler", "~> 1.6" spec.add_development_dependency "rake" spec.add_development_dependency "rspec" - spec.add_development_dependency "color_print" - spec.add_development_dependency "sqlite3" - end
Add depending gems as dependency.
diff --git a/test/form_forms/elements/block_test.rb b/test/form_forms/elements/block_test.rb index abc1234..def5678 100644 --- a/test/form_forms/elements/block_test.rb +++ b/test/form_forms/elements/block_test.rb @@ -1,6 +1,6 @@ require 'test_helper' -class FieldsetTest < ActionView::TestCase +class BlockTest < ActionView::TestCase test "create a block" do with_form_for(@user) do |form| form.block(:red_box, :div, :class => "red_box") do |block|
Use the correct class name for the test
diff --git a/test/helpers/lazy_image_helper_test.rb b/test/helpers/lazy_image_helper_test.rb index abc1234..def5678 100644 --- a/test/helpers/lazy_image_helper_test.rb +++ b/test/helpers/lazy_image_helper_test.rb @@ -7,11 +7,11 @@ test "should create image tag with lazy loader" do # simple use - assert_equal '<img data-src="/images/github.svg" class="lazyload" src="/images/default.svg" alt="github" />', lazy_image_tag('github.svg') + assert_equal '<img data-src="http://test.host/images/github.svg" class="lazyload" src="http://test.host/images/default.svg" alt="Default" />', lazy_image_tag('github.svg') - assert_equal '<img data-src="/images/github.svg" class="test lazyload" src="/images/default.svg" alt="github" />', lazy_image_tag('github.svg', class: 'test') + assert_equal '<img class="test lazyload" data-src="http://test.host/images/github.svg" src="http://test.host/images/default.svg" alt="Default" />', lazy_image_tag('github.svg', class: 'test') - assert_equal '<img data-src="/images/github.svg" class="test lazyload" src="/images/default.svg" alt="hello" />', lazy_image_tag('github.svg', class: 'test', alt: 'hello') + assert_equal '<img class="test lazyload" alt="hello" data-src="http://test.host/images/github.svg" src="http://test.host/images/default.svg" />', lazy_image_tag('github.svg', class: 'test', alt: 'hello') end
Correct order of html attributes for unit tests
diff --git a/app/builders/template_builder/from_json.rb b/app/builders/template_builder/from_json.rb index abc1234..def5678 100644 --- a/app/builders/template_builder/from_json.rb +++ b/app/builders/template_builder/from_json.rb @@ -18,7 +18,7 @@ def create_images(images_hash) images_hash.map do |image_hash| - image_hash['categories'] = [image_hash.delete('category')] + image_hash['categories'] = Array(image_hash.delete('category')) Image.new(image_hash) end end
Fix nil category issue when hydrating images from JSON
diff --git a/app/controllers/admin/themes_controller.rb b/app/controllers/admin/themes_controller.rb index abc1234..def5678 100644 --- a/app/controllers/admin/themes_controller.rb +++ b/app/controllers/admin/themes_controller.rb @@ -11,7 +11,8 @@ def switchto - setting = Setting.find_by_name('theme') + setting = (Setting.find_by_name('theme') or Setting.new("name" => 'theme')) + setting.value = params[:theme] setting.save
Create new setting in ThemesController if a 'theme' setting doesn't already exist git-svn-id: 70ab0960c3db1cbf656efd6df54a8f3de72dc710@427 820eb932-12ee-0310-9ca8-eeb645f39767
diff --git a/lib/tasks/sample_data/shipping_method_factory.rb b/lib/tasks/sample_data/shipping_method_factory.rb index abc1234..def5678 100644 --- a/lib/tasks/sample_data/shipping_method_factory.rb +++ b/lib/tasks/sample_data/shipping_method_factory.rb @@ -26,7 +26,7 @@ def create_pickup(enterprise) create_shipping_method( enterprise, - name: "Pickup", + name: "Pickup #{enterprise.name}", description: "pick-up at your awesome hub gathering place", require_ship_address: false, calculator_type: "Calculator::Weight" @@ -36,7 +36,7 @@ def create_delivery(enterprise) delivery = create_shipping_method( enterprise, - name: "Home delivery", + name: "Home delivery #{enterprise.name}", description: "yummy food delivered at your door", require_ship_address: true, calculator_type: "Spree::Calculator::FlatRate"
Make ship methods in sample data have the name of the enterprise so it's easier to distinguish them
diff --git a/spec/controllers/help_controller_spec.rb b/spec/controllers/help_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/help_controller_spec.rb +++ b/spec/controllers/help_controller_spec.rb @@ -0,0 +1,16 @@+require "spec_helper" + +describe HelpController, type: :controller do + describe "#faq" do + it "succeeds" do + get :faq + expect(response).to be_success + end + + it "fails on mobile" do + expect { + get :faq, format: :mobile + }.to raise_error ActionView::MissingTemplate + end + end +end
Add basic help controller spec
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/user_controller_spec.rb +++ b/spec/controllers/user_controller_spec.rb @@ -0,0 +1,61 @@+require 'spec_helper' + +describe UserController do + + let :member do + Factory(:member, username: 'bulkneets', password: 'mala', password_confirmation: 'mala') + end + + let :rss_mime_type do + Mime::Type.lookup_by_extension(:rss).to_s + end + + let :opml_mime_type do + Mime::Type.lookup_by_extension(:opml).to_s + end + + describe 'GET /' do + it 'renders the index template' do + get :index, login_name: member.username + expect(response).to be_success + expect(response).to render_template('index') + end + + it 'renders rss' do + request.accept = rss_mime_type + get :index, login_name: member.username + expect(response).to be_success + expect(response).to render_template('index') + expect(response.content_type).to be_equal rss_mime_type + end + + it 'renders opml' do + request.accept = opml_mime_type + get :index, login_name: member.username + expect(response).to be_success + expect(response).to render_template('index') + expect(response.content_type).to be_equal opml_mime_type + end + end + + describe 'GET /rss' do + it 'renders rss' do + request.accept = rss_mime_type + get :index, login_name: member.username + expect(response).to be_success + expect(response).to render_template('index') + expect(response.content_type).to be_equal rss_mime_type + end + end + + describe 'GET /opml' do + it 'renders opml' do + request.accept = opml_mime_type + get :index, login_name: member.username + expect(response).to be_success + expect(response).to render_template('index') + expect(response.content_type).to be_equal opml_mime_type + end + end + +end
Add spec for user controller
diff --git a/spec/fc-reminder/gateways/twilio_spec.rb b/spec/fc-reminder/gateways/twilio_spec.rb index abc1234..def5678 100644 --- a/spec/fc-reminder/gateways/twilio_spec.rb +++ b/spec/fc-reminder/gateways/twilio_spec.rb @@ -36,8 +36,8 @@ body: anything() } - expect(gateway.client.account.messages). - to receive(:create) + expect(gateway.client.account.messages) + .to receive(:create) .once .with(args)
Move dot to new line
diff --git a/spec/feature/component_generator_spec.rb b/spec/feature/component_generator_spec.rb index abc1234..def5678 100644 --- a/spec/feature/component_generator_spec.rb +++ b/spec/feature/component_generator_spec.rb @@ -0,0 +1,23 @@+RSpec.feature 'Component generator', :js do + let(:test_component_path) do + UiComponents::Engine.root.join('app', 'cells', 'test_component') + end + + before do + expect(Dir.exist?(test_component_path)).to be(false) + `bundle exec thor generate_component test_component` + expect(Dir.exist?(test_component_path)).to be(true) + require test_component_path.join('test_component_cell') + end + + after do + FileUtils.rm_r(test_component_path) + end + + scenario 'generates a new component' do + visit '/' + + expect(page).to have_content('TestComponentCell') + expect(page).to have_content("I didn't change the default description.") + end +end
Add test for component generator
diff --git a/spec/models/events/deck_shuffled_spec.rb b/spec/models/events/deck_shuffled_spec.rb index abc1234..def5678 100644 --- a/spec/models/events/deck_shuffled_spec.rb +++ b/spec/models/events/deck_shuffled_spec.rb @@ -20,4 +20,28 @@ expect(event.value).to be_empty end end + + context "built from the factory" do + subject(:event) { DeckShuffled.build } + + it "should have no associated game" do + expect(event.game).to be nil + end + + it "should modify the deck" do + expect(event.state_attribute).to eq "deck=" + end + + it "should have an encoded value" do + expect(event.encoded_value).to be_present + end + + it "should have an array which is not empty for its value" do + expect(event.value).not_to be_empty + end + + it "should have not have an unshuffled deck for its value" do + expect(event.value.join).not_to eq Game::UNSHUFFLED_DECK.join + end + end end
Add tests for factory-built event
diff --git a/lib/base.rb b/lib/base.rb index abc1234..def5678 100644 --- a/lib/base.rb +++ b/lib/base.rb @@ -62,7 +62,9 @@ end def parse_and_validate(response) - Response.new(response, TransactionLogger).parse_and_validate + Response + .new(@signature_key, response, TransactionLogger) + .parse_and_validate end end
Fix params passed to response
diff --git a/core/app/models/spree/user.rb b/core/app/models/spree/user.rb index abc1234..def5678 100644 --- a/core/app/models/spree/user.rb +++ b/core/app/models/spree/user.rb @@ -21,6 +21,10 @@ create end + def has_spree_role?(role) + true + end + attr_accessor :password attr_accessor :password_confirmation end
Define has_spree_role? dummy method on Spree::User
diff --git a/test/fixtures/cookbooks/ghostdriver_test/metadata.rb b/test/fixtures/cookbooks/ghostdriver_test/metadata.rb index abc1234..def5678 100644 --- a/test/fixtures/cookbooks/ghostdriver_test/metadata.rb +++ b/test/fixtures/cookbooks/ghostdriver_test/metadata.rb @@ -7,6 +7,7 @@ version '0.1.0' depends 'apt' +depends 'yum' depends 'aws' depends 'java' depends 'windows', '~> 1.37.0' # 1.38 spams warning about windows_reboot being removed
Add yum cookbook to update packages
diff --git a/app/models/material.rb b/app/models/material.rb index abc1234..def5678 100644 --- a/app/models/material.rb +++ b/app/models/material.rb @@ -4,7 +4,7 @@ belongs_to :license belongs_to :state - has_many :slices + has_many :chunks validates :owner, presence: true validates :rightholder, presence: true
Fix association name slices to chunks
diff --git a/test/fixtures/cookbooks/install_varnish/metadata.rb b/test/fixtures/cookbooks/install_varnish/metadata.rb index abc1234..def5678 100644 --- a/test/fixtures/cookbooks/install_varnish/metadata.rb +++ b/test/fixtures/cookbooks/install_varnish/metadata.rb @@ -2,4 +2,3 @@ version '0.0.1' depends 'varnish' -depends 'apt'
Remove apt dep from the test cookbook The main cookbook already requires it Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/test/remote/gateways/remote_secure_pay_tech_test.rb b/test/remote/gateways/remote_secure_pay_tech_test.rb index abc1234..def5678 100644 --- a/test/remote/gateways/remote_secure_pay_tech_test.rb +++ b/test/remote/gateways/remote_secure_pay_tech_test.rb @@ -25,6 +25,22 @@ assert_failure response end + def test_successful_cvv_check + @credit_card.verification_value = '100' + + # Use a different amount to the previous test, otherwise SPT assumes that this is a repost of a previous transaction + assert response = @gateway.purchase(@accepted_amount + 100, @credit_card, @options) + assert_equal 'Transaction OK', response.message + assert_success response + end + + def test_unsuccessful_cvv_check + @credit_card.verification_value = '104' + assert response = @gateway.purchase(@accepted_amount + 200, @credit_card, @options) + assert_equal 'Card declined', response.message + assert_failure response + end + def test_invalid_login gateway = SecurePayTechGateway.new( :login => 'foo',
Add tests for Secure Pay Tech CSC checks
diff --git a/gitable.gemspec b/gitable.gemspec index abc1234..def5678 100644 --- a/gitable.gemspec +++ b/gitable.gemspec @@ -11,7 +11,7 @@ s.add_dependency "addressable", ">= 2.2.7" s.add_development_dependency "rspec", "~>2.11" - s.add_development_dependency "rake", "< 11" + s.add_development_dependency "rake" s.add_development_dependency "simplecov" s.files = `git ls-files`.split("\n")
Revert "pin rake < 11 as last_comment is removed" This reverts commit 1fb4d8ab84069f25d3066d4b8e27224180e82cae.
diff --git a/lib/noaa_weather_client/responses/validatable_xml_response.rb b/lib/noaa_weather_client/responses/validatable_xml_response.rb index abc1234..def5678 100644 --- a/lib/noaa_weather_client/responses/validatable_xml_response.rb +++ b/lib/noaa_weather_client/responses/validatable_xml_response.rb @@ -9,7 +9,8 @@ Dir.chdir(SCHEMA_PATH) do schema_file = File.join(SCHEMA_PATH, "#{schema_name}.xsd") schema = Nokogiri::XML::Schema(File.read(schema_file)) - unless (errors = schema.validate(doc)).empty? + errors = schema.validate(doc) + unless errors.empty? raise InvalidXmlError, "Invalid xml: #{errors.map(&:message).join("\n")}" end end
Fix assignment condition for jruby.
diff --git a/test/models/json_config_test.rb b/test/models/json_config_test.rb index abc1234..def5678 100644 --- a/test/models/json_config_test.rb +++ b/test/models/json_config_test.rb @@ -9,6 +9,10 @@ "DateTime" => { "display_components" => [], "editor_components" => ["DateTimeInput"] + }, + "Geometry" => { + "display_components" => [], + "editor_components" => ["GeoEditor"] } } assert_equal(expected_config, config) @@ -21,6 +25,10 @@ "DateTime" => { "display_components" => [], "editor_components" => ["DateTimeInput"] + }, + "Geometry" => { + "display_components" => [], + "editor_components" => ["GeoEditor"] } } assert_equal(expected_config, config)
Adjust default React input configuration in tests
diff --git a/kinksync.gemspec b/kinksync.gemspec index abc1234..def5678 100644 --- a/kinksync.gemspec +++ b/kinksync.gemspec @@ -13,15 +13,6 @@ spec.homepage = 'https://github.com/Pizzicato/kinksync' spec.license = 'MIT' - # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' - # to allow pushing to a single host or delete this section to allow pushing to any host. - if spec.respond_to?(:metadata) - spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'" - else - raise 'RubyGems 2.0 or newer is required to protect against ' \ - 'public gem pushes.' - end - spec.files = `git ls-files -z`.split("\x0").reject do |f| f.match(%r{^(test|spec|features)/}) end
Fix spec to allow push to RubyGems
diff --git a/lib/shipistrano/helpers/slack.rb b/lib/shipistrano/helpers/slack.rb index abc1234..def5678 100644 --- a/lib/shipistrano/helpers/slack.rb +++ b/lib/shipistrano/helpers/slack.rb @@ -37,4 +37,4 @@ # wait till hash is changed. after 'deploy:update_code', 'slack:prenotify' -after 'deploy:cleanup', 'slack:postnotify' +after 'deploy:update', 'slack:postnotify'
Deploy update only runs once.
diff --git a/spec/indifferent_spec.rb b/spec/indifferent_spec.rb index abc1234..def5678 100644 --- a/spec/indifferent_spec.rb +++ b/spec/indifferent_spec.rb @@ -15,7 +15,7 @@ it "should make requests handle empty params" do params = Rack::Request.new(Rack::MockRequest.env_for('/', :input=>'i=j&k[l]=m&n[][o]=p', :method=>'POST')).params - params[:a].must_equal nil + params[:a].must_be_nil params[:i].must_equal 'j' params[:k][:l].must_equal 'm' params[:n][0][:o].must_equal 'p'
Change must_equal nil to must_be_nil in specs Minitest 5.10 started warning about must_equal nil.
diff --git a/lib/tech404/index/application.rb b/lib/tech404/index/application.rb index abc1234..def5678 100644 --- a/lib/tech404/index/application.rb +++ b/lib/tech404/index/application.rb @@ -51,7 +51,9 @@ end def user_name(user) - user.real_name || user.name + name = user.real_name.to_s + name = user.name if name.empty? + name end end end
Check for empty string names instead of nils
diff --git a/lib/ui_components/form_helper.rb b/lib/ui_components/form_helper.rb index abc1234..def5678 100644 --- a/lib/ui_components/form_helper.rb +++ b/lib/ui_components/form_helper.rb @@ -9,7 +9,13 @@ def modelless_form(options, &block) model_params = options[:params] || params[options[:name]] struct = ValidatedOpenStruct.new(model_params) - bootstrap_form_for(struct, as: options[:name], url: options[:url].to_s, &block) + bootstrap_form_for( + struct, + as: options[:name], + url: options[:url].to_s, + method: options.fetch(:method, :post), + &block + ) end end end
Allow passing method via options
diff --git a/lib/versionone/versionone-api.rb b/lib/versionone/versionone-api.rb index abc1234..def5678 100644 --- a/lib/versionone/versionone-api.rb +++ b/lib/versionone/versionone-api.rb @@ -0,0 +1,97 @@+require 'rubygems' +require 'active_support' +require 'active_resource' + + +# Ruby lib for working with the VersionOne API's XML interface. +# You should set the authentication using your login +# credentials with HTTP Basic Authentication. + +# This library is a small wrapper around the REST interface + +module VersiononeAPI + class Error < StandardError; end + class << self + + #Sets up basic authentication credentials for all the resources. + def authenticate(servname, username, password) + @server = servname + @username = username + @password = password + self::Base.user = username + self::Base.password = password + + resources.each do |klass| + klass.site = "#{servname}rest-1.v1/Data/" + end + end + + def resources + @resources ||= [] + end + end + + class Base < ActiveResource::Base + def self.inherited(base) + VersiononeAPI.resources << base + super + end + end + + # Find projects + # + # VersiononeAPI::Project.find(:all) # find all projects for the current account. + # VersiononeAPI::Project.find('my_project') # find individual project by ID + # + # Creating a Project + # + # project = VersiononeAPI::Project.new(:name => 'Ninja Whammy Jammy') + # project.save + # # => true + # + # + # Updating a Project + # + # project = VersiononeAPI::Project.find('my_project') + # project.name = "A new name" + # project.save + # + # Finding tickets + # + # project = VersiononeAPI::Project.find('my_project') + # project.tickets + # + + class Scope < Base + + def self.collection_path(prefix_options = {}, query_options = nil) + prefix_options, query_options = split_options(prefix_options) if query_options.nil? + "#{prefix(prefix_options)}Scope#{query_string(query_options)}" + end + + def self.instantiate_collection(collection, prefix_options = {}) + objects = collection["Asset"] + objects.collect! { |record| instantiate_record(record, prefix_options) } + end + + def self.element_path(id, prefix_options = {}, query_options = nil) + prefix_options, query_options = split_options(prefix_options) if query_options.nil? + "#{prefix(prefix_options)}Scope/#{URI.escape id.to_s}#{query_string(query_options)}" + end + + def encode(options={}) + val = "" + val += "<Asset>" + attributes.each_pair do |key, value| + val += "<Attribute name='#{key}' act='set'>#{value}</Attribute>" + end + val += "</Asset>" + end + + end + + class Task < Base + + end + +end
Fix POST method for Project class
diff --git a/test/cookbooks/hipsnip-solr_test/recipes/solr_4.rb b/test/cookbooks/hipsnip-solr_test/recipes/solr_4.rb index abc1234..def5678 100644 --- a/test/cookbooks/hipsnip-solr_test/recipes/solr_4.rb +++ b/test/cookbooks/hipsnip-solr_test/recipes/solr_4.rb @@ -1,9 +1,9 @@-node.set['solr']['version'] = '4.2.1' -node.set['solr']['checksum'] = '648a4b2509f6bcac83554ca5958cf607474e81f34e6ed3a0bc932ea7fac40b99' +node.set['solr']['version'] = '4.5.1' +node.set['solr']['checksum'] = '8f53f9a317cbb2f0c8304ecf32aa3b8c9a11b5947270ba8d1d6372764d46f781' node.set['jetty']['port'] = 8983 -node.set['jetty']['version'] = '9.0.3.v20130506' -node.set['jetty']['link'] = 'http://eclipse.org/downloads/download.php?file=/jetty/9.0.3.v20130506/dist/jetty-distribution-9.0.3.v20130506.tar.gz&r=1' -node.set['jetty']['checksum'] = 'eff8c9c63883cae04cec82aca01640411a6f8804971932cd477be2f98f90a6c4' +node.set['jetty']['version'] = '9.0.6.v20130930' +node.set['jetty']['link'] = 'http://eclipse.org/downloads/download.php?file=/jetty/9.0.6.v20130930/dist/jetty-distribution-9.0.6.v20130930.tar.gz&r=1' +node.set['jetty']['checksum'] = 'c35c6c0931299688973e936186a6237b69aee2a7912dfcc2494bde9baeeab58f' include_recipe 'hipsnip-solr'
NEW: Update solr 4 test with latest version of solr and jetty.
diff --git a/app/controllers/feeds_controller.rb b/app/controllers/feeds_controller.rb index abc1234..def5678 100644 --- a/app/controllers/feeds_controller.rb +++ b/app/controllers/feeds_controller.rb @@ -1,9 +1,14 @@ class FeedsController < ApplicationController enable_request_formats organisation: :atom + before_action do + # Allows ajax requests as per https://govuk.zendesk.com/agent/tickets/1935680 + if request.format.atom? + response.headers["Access-Control-Allow-Origin"] = "*" + end + end + def organisation - set_access_control_allow_origin_header if request.format.atom? - path = "/government/organisations/#{organisation_name}#{locale}" @organisation = Organisation.find!(path) @@ -13,11 +18,6 @@ private - # allows ajax requests as per https://govuk.zendesk.com/agent/tickets/1935680 - def set_access_control_allow_origin_header - response.headers["Access-Control-Allow-Origin"] = "*" - end - def organisation_name params[:organisation_name] end
Move CORS headers to before_action This way new method will also be able to use this controller.
diff --git a/app/controllers/ideas_controller.rb b/app/controllers/ideas_controller.rb index abc1234..def5678 100644 --- a/app/controllers/ideas_controller.rb +++ b/app/controllers/ideas_controller.rb @@ -12,8 +12,7 @@ end def create - @idea = Idea.new(idea_params) - @idea.user_id = current_user.id + @idea = current_user.ideas.build(idea_params) if @idea.save flash[:success] = "Idea created!" @@ -54,6 +53,6 @@ def correct_user @idea = current_user.ideas.find_by(id: params[:id]) - redirect_to root_url if @idea.nil? + redirect_to root_url unless @idea end end
Refactor idea_controlloer for review comments - @idea = current_user.ideas.new(idea_params)a - replace 'if not' by 'unless'
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -7,10 +7,7 @@ @post = @group.posts.build(post_params) @post.user_id = current_user.id if @post.save - flash[:success] = "Post created!" - redirect_to '/' - else - flash[:error] = "Nope" + redirect_to group_path(@group), notice: "Post has been saved successfully." end end
Fix redirect in create post method
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index abc1234..def5678 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -4,20 +4,10 @@ def index @group = Group.friendly.find(params[:group_id]) - @posts = @group.posts - respond_to do |format| - format.html - format.json { render json: @posts } - end end def new @post = Post.new - - respond_to do |format| - format.html - format.js - end end # TODO (Shimmy): Watch out for duplicates @@ -25,7 +15,6 @@ def create @group = Group.friendly.find(params[:group_id]) @post = @group.posts.build(post_params) - @post.user_id = current_user.id @post.save end @@ -36,7 +25,7 @@ # TODO (Shimmy): Add picture support def post_params - params.require(:post).permit(:title, :content, :user_id, :group_id) + params.require(:post).permit(:title, :content, :user_id, :group_id).merge(user_id: current_user.id) end # TODO (Shimmy): Use CanCanCan instead.
Remove respond_to blocks. Use merge
diff --git a/app/controllers/tours_controller.rb b/app/controllers/tours_controller.rb index abc1234..def5678 100644 --- a/app/controllers/tours_controller.rb +++ b/app/controllers/tours_controller.rb @@ -13,13 +13,13 @@ def create session[:touring] = true - expire_fragment(%r{views/people/#{@logged_in.id}_}) + expire_fragment(%r{views/people/.+_#{@logged_in.id}}) redirect_to stream_path end def destroy session[:touring] = false - expire_fragment(%r{views/people/#{@logged_in.id}_}) + expire_fragment(%r{views/people/.+_#{@logged_in.id}}) redirect_back end
Expire people cache *for* logged in person. Before, stopping the tour would only expire the logged-in user's profile cache. Now, it will expire any cached profiles for the logged-in user, which is better.
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -26,6 +26,12 @@ end def update + if @user.update_attributes(user_params) + render :show + else + @errors = @user.errors.messages + redirect_to :back + end end def destroy
Create action for user update
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index abc1234..def5678 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -5,63 +5,7 @@ # GET - Show a user. def show - @user = User.find(params[:id]) + @user = User.find(current_user) end - # GET - Show template to create a user. - def new - @user = User.new - end - - # POST - Create a user. - def create - @user = User.new(user_params) - - if @user.save - flash[:success] = "Welcome to move #{user_params[:name]}" - redirect_to user_path(@user) - else - flash[:error] = @user.errors.full_messages[0] - render 'new' - end - end - - # GET - Show template to edit a user. - def edit - end - - # PUT - Update a user. - def update - end - - # DELETE - Delete a user. - def delete - end - - # GET - Show Login template. - def login - @user = User.new - end - - def auth_local - @user = User.find_by_email(params[:user][:email]) - - if (@user != nil) - if (@user.password == params[:user][:password]) - redirect_to user_path(@user) - else - flash[:error] = "Your enter a wrong password." - redirect_to root_path - end - else - flash[:error] = "This user doesn't exists." - redirect_to root_path - end - - end - - private - def user_params - params.require(:user).permit(:name, :password, :email, :tel, :country, :user_picture) - end end
Remove part of the user controller logic Now devise will handle user auth.
diff --git a/lib/bible_xml.rb b/lib/bible_xml.rb index abc1234..def5678 100644 --- a/lib/bible_xml.rb +++ b/lib/bible_xml.rb @@ -56,7 +56,7 @@ end def parser_class - PARSERS[format] or fail(ParserUnavailableError, "Parser for #{format.inspect} could not be loaded.") + PARSERS[format] or fail(Errors::ParserUnavailableError, "Parser for #{format.inspect} could not be loaded.") end def detect_format
Fix error when parser not found
diff --git a/lib/fropy/cli.rb b/lib/fropy/cli.rb index abc1234..def5678 100644 --- a/lib/fropy/cli.rb +++ b/lib/fropy/cli.rb @@ -6,6 +6,7 @@ Usage: fropy <command> [--dev-null] [--poll-interval=POLL] fropy -h | --help + fropy -v | --version Options: -h --help Show this help @@ -18,7 +19,10 @@ require "pp" begin options = Docopt::docopt(Doc) - pp options + if options["-v"] || options["--version"] + puts "Fropy #{Fropy::VERSION}" + exit + end benchmark = Benchmark.new options["<command>"], poll_interval: options["--poll-interval"].to_f, dev_null: options["--dev-null"]
Remove printing of parsed options, and add (-v | --version) CLI flag to print version.
diff --git a/app/models/spree/order_decorator.rb b/app/models/spree/order_decorator.rb index abc1234..def5678 100644 --- a/app/models/spree/order_decorator.rb +++ b/app/models/spree/order_decorator.rb @@ -17,6 +17,8 @@ end end + self.update_totals + adjustments.reload end
Update totals after fees are added Change-Id: I5d83de53ad64f0cdc51d4ddffc11a530f811926f
diff --git a/app/controllers/base_controllers/virtual_host.rb b/app/controllers/base_controllers/virtual_host.rb index abc1234..def5678 100644 --- a/app/controllers/base_controllers/virtual_host.rb +++ b/app/controllers/base_controllers/virtual_host.rb @@ -14,6 +14,7 @@ def convention @convention ||= env["intercode.convention"] end + helper_method :convention # Make the current convention object available to CMS templates, so they can do, for example: # <h1>Welcome to {{ convention.name }}, {{ user.name }}!</h1> @@ -22,4 +23,4 @@ end end -end+end
Make convention available to all classes derived from BaseControllers::VirtualHost
diff --git a/app/controllers/budgets/executions_controller.rb b/app/controllers/budgets/executions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/budgets/executions_controller.rb +++ b/app/controllers/budgets/executions_controller.rb @@ -17,7 +17,7 @@ @headings = @headings.where(filter_investment_by_latest_milestone, params[:status]) end - @headings = reorder_with_city_heading_first(@headings) + @headings = reorder_alphabetically_with_city_heading_first(@headings) end private @@ -33,17 +33,15 @@ SQL end - def reorder_with_city_heading_first(original_headings) - headings = original_headings.to_a.dup - - city_heading_index = headings.find_index do |heading| - heading.name == "Toda la ciudad" - end - - if city_heading_index - headings.insert(0, headings.delete_at(city_heading_index)) - else - headings + def reorder_alphabetically_with_city_heading_first(headings) + headings.sort do |a, b| + if a.name == 'Toda la ciudad' + -1 + elsif b.name == 'Toda la ciudad' + 1 + else + a.name <=> b.name + end end end end
Refactor how headings are ordered
diff --git a/app/controllers/concerns/key_stage_filterable.rb b/app/controllers/concerns/key_stage_filterable.rb index abc1234..def5678 100644 --- a/app/controllers/concerns/key_stage_filterable.rb +++ b/app/controllers/concerns/key_stage_filterable.rb @@ -20,7 +20,9 @@ end def default_filters - if current_user.nil? || current_user.school.nil? + if @school + @school.key_stage_list + elsif current_user.nil? || current_user.school.nil? # TODO remove this hardcoding %w(KS1 KS2 KS3) else
Fix default if you look at a school, default to the school's key stages
diff --git a/app/workers/scheduler/subscriptions_scheduler.rb b/app/workers/scheduler/subscriptions_scheduler.rb index abc1234..def5678 100644 --- a/app/workers/scheduler/subscriptions_scheduler.rb +++ b/app/workers/scheduler/subscriptions_scheduler.rb @@ -1,8 +1,5 @@ # frozen_string_literal: true -<<<<<<< HEAD -======= require 'sidekiq-scheduler' ->>>>>>> 8963f8c3c2630bfcc377a5ca0513eef5a6b2a4bc class Scheduler::SubscriptionsScheduler include Sidekiq::Worker
Resolve a merged conflict - Scheduler::SubscriptionsScheduler
diff --git a/test.rb b/test.rb index abc1234..def5678 100644 --- a/test.rb +++ b/test.rb @@ -2,28 +2,22 @@ $LOAD_PATH.unshift "." require "c64/cpu" require "c64/memory" -require "c64/memory_overlay" +require "c64/address_bus" module C64 - ram = Memory.new(0x10000) # 64k - kernal = Memory.new(0x2000, image: "rom/kernal.rom") # 8k - char = Memory.new(0x1000, image: "rom/character.rom") # 4k - basic = Memory.new(0x2000, image: "rom/basic.rom") # 8k + # TODO: why is BASIC not being read? + # TODO: check implied (+indexed) addressing.. carry? - memory = MemoryOverlay.new( - MemoryOverlay.new( - MemoryOverlay.new( - ram, - kernal, - 0xE000 - ), - char, - 0xD000 - ), - basic, - 0xA000 - ) + memory = AddressBus.new \ + ram: Memory.new(0x10000, tag: nil), # 64k + kernal: Memory.new(0x2000, image: "rom/kernal.rom"), # 8k + basic: Memory.new(0x2000, image: "rom/basic.rom", tag: "BASIC"), # 8k + char: Memory.new(0x1000, image: "rom/character.rom", tag: "CHAR"), # 4k + io: Memory.new(0x1000, tag: nil) # 4k + + memory[0x0000] = 0b101111 # directions, 0:in, 1:out + memory[0x0001] = 0b000111 # data cpu = Cpu.new memory: memory
Test script loads ROMs into AddressBus.
diff --git a/lib/paginate-responder.rb b/lib/paginate-responder.rb index abc1234..def5678 100644 --- a/lib/paginate-responder.rb +++ b/lib/paginate-responder.rb @@ -10,7 +10,6 @@ module Adapter autoload :Base, 'paginate-responder/adapter/base' - autoload :Internal, 'paginate-responder/adapter/internal' end end
Remove old internal adapter from autoload.
diff --git a/lib/search_object/base.rb b/lib/search_object/base.rb index abc1234..def5678 100644 --- a/lib/search_object/base.rb +++ b/lib/search_object/base.rb @@ -10,7 +10,7 @@ end def initialize(*args) - @scope, @filters = self.class.scope_and_filters(args) + @search = self.class.search args end def results @@ -22,40 +22,29 @@ end def count - @count ||= _fetch_results.count + @count ||= @search.count self end def params(additions = {}) if additions.empty? - @filters + @search.params else - @filters.merge Helper.stringify_keys(additions) + @search.params.merge Helper.stringify_keys(additions) end end private def fetch_results - _fetch_results - end - - def _fetch_results - self.class.fetch_results_for @scope, self + @search.query self end module ClassMethods - def scope_and_filters(args) + def search(args) scope = (@scope && @scope.call) || args.shift params = @defaults.merge(Helper.select_keys Helper.stringify_keys(args.shift || {}), @actions.keys) - [scope, params] - end - - def fetch_results_for(scope, search) - search.params.inject(scope) do |scope, (name, value)| - new_scope = search.instance_exec scope, value, &@actions[name] - new_scope || scope - end + Search.new scope, params, @actions end def scope(&block) @@ -68,7 +57,7 @@ @defaults[name] = default unless default.nil? @actions[name] = block || ->(scope, value) { scope.where name => value } - define_method(name) { @filters[name] } + define_method(name) { @search.param name } end end end
Use Search object for searching
diff --git a/lib/services/depending.rb b/lib/services/depending.rb index abc1234..def5678 100644 --- a/lib/services/depending.rb +++ b/lib/services/depending.rb @@ -1,5 +1,9 @@ class Service::Depending < Service string :token + + url "http://depending.in/" + + maintained_by :github => 'toopay' def receive_push http.ssl[:verify] = false
Add maintainer and url details
diff --git a/lib/tasks/mfa_policy.rake b/lib/tasks/mfa_policy.rake index abc1234..def5678 100644 --- a/lib/tasks/mfa_policy.rake +++ b/lib/tasks/mfa_policy.rake @@ -0,0 +1,32 @@+require "resolv" + +def mx_exists?(email) + domain = email.split("@").last + mx_resolver = Resolv::DNS.new + mx_resolver.timeouts = 10 + + return false if mx_resolver.getresources(domain, Resolv::DNS::Resource::IN::MX).empty? + true +rescue StandardError => e + puts "Error during processing: #{$ERROR_INFO}" + puts "Backtrace:\n\t#{e.backtrace.join("\n\t")}" + false +end + +namespace :mfa_policy do + # To be sent on launch day (June 13, 2022) + # rake mfa_policy:announce_recommendation + desc "Send email notification to all users about MFA Phase 2 rollout (MFA Recommendation for popular gems)" + task announce_recommendation: :environment do + users = User.all + total_users = users.count + puts "Sending #{total_users} MFA announcement email" + + i = 0 + users.find_each do |user| + Mailer.delay.mfa_recommendation_announcement(user.id) if mx_exists?(user.email) + i += 1 + print format("\r%.2f%% (%d/%d) complete", i.to_f / total_users * 100.0, i, total_users) + end + end +end
Add rake task to deliver mfa recommendation announcement mailer
diff --git a/lib/hotspots.rb b/lib/hotspots.rb index abc1234..def5678 100644 --- a/lib/hotspots.rb +++ b/lib/hotspots.rb @@ -6,20 +6,14 @@ require "hotspots/repository" class Hotspots + attr_reader :configuration + def initialize(configuration) - @configuration = configuration - @logger = @configuration.logger - @repository = @configuration.repository - @exit_strategy = @configuration.exit_strategy - @time = @configuration.time - @message_filters = @configuration.message_filters - @file_filter = @configuration.file_filter - @cutoff = @configuration.cutoff + @configuration = configuration end def output validate - assign inside_repository do run end @@ -28,29 +22,38 @@ private def validate - @exit_strategy.perform - prepare_for_exit_if_git_status_invalid - @exit_strategy.perform - end - - def assign - @driver = Hotspots::Repository::GitDriver.new(:logger => @logger) - @parser = Hotspots::Repository::GitParser.new(@driver, :time => @time, :message_filters => @message_filters) - @store = Hotspots::Store.new(@parser.files, :cutoff => @cutoff, :file_filter => @file_filter) + configuration.exit_strategy.perform + ensure_git_repository end def inside_repository - yield Dir.chdir(@repository) + yield Dir.chdir(repository) end def run - puts @store.to_s + puts store.to_s end - def prepare_for_exit_if_git_status_invalid + def ensure_git_repository `git status 2>&1` unless $? == 0 - @exit_strategy = Hotspots::Exit::Error.new(:message => "'#{@repository}' doesn't seem to be a git repository!", :code => 10) + Hotspots::Exit::Error.new(:message => "'#{@repository}' doesn't seem to be a git repository!", :code => 10).perform end end + + def repository + configuration.repository + end + + def store + Hotspots::Store.new(parser.files, :cutoff => configuration.cutoff, :file_filter => configuration.file_filter) + end + + def parser + Hotspots::Repository::GitParser.new(driver, :time => configuration.time, :message_filters => configuration.message_filters) + end + + def driver + Hotspots::Repository::GitDriver.new(:logger => configuration.logger) + end end
Reduce the use of instance level variables
diff --git a/lib/proxyreverse/frontendrequest.rb b/lib/proxyreverse/frontendrequest.rb index abc1234..def5678 100644 --- a/lib/proxyreverse/frontendrequest.rb +++ b/lib/proxyreverse/frontendrequest.rb @@ -40,7 +40,7 @@ end def on_body(chunk) - client.relay_to_servers(chunk) + @client.relay_to_servers(chunk) end def on_message_complete
Fix bug with requests with body failing.
diff --git a/lib/patterns.rb b/lib/patterns.rb index abc1234..def5678 100644 --- a/lib/patterns.rb +++ b/lib/patterns.rb @@ -10,7 +10,6 @@ abbrev base64 benchmark - bigdecimal cgi cgi-session cmath @@ -34,8 +33,6 @@ find forwardable getoptlong - gserver - io-console io-nonblock io-wait ipaddr @@ -52,7 +49,6 @@ net-pop net-protocol net-smtp - net-telnet nkf observer open-uri
Remove extracted gems from blacklist. These need to maintain as standalone gem without blacklist. * io-console: https://github.com/ruby/ruby/tree/trunk/ext/io/console * bigdecimal: https://github.com/ruby/bigdecimal * net-telnet: https://github.com/ruby/net-telnet * gserver: https://github.com/ruby/gserver
diff --git a/lib/vines/web.rb b/lib/vines/web.rb index abc1234..def5678 100644 --- a/lib/vines/web.rb +++ b/lib/vines/web.rb @@ -5,9 +5,18 @@ module Vines module Web + # Return javascript and stylesheet asset paths to be added to a sprockets + # environment. This allows the lib and vendor javascript bundles to be + # shared by other apps. + # + # env = Sprockets::Environment.new + # Vines::Web.paths.each {|path| env.append_path path } + # + # Returns an Array of String paths. def self.paths - js = File.expand_path('../../../app/assets/javascripts', __FILE__) - css = File.expand_path('../../../app/assets/stylesheets', __FILE__) + root = File.expand_path('../../..', __FILE__) + js = '%s/app/assets/javascripts' % root + css = '%s/app/assets/stylesheets' % root [js, css] end end
Add paths method for asset reuse.
diff --git a/app/validators/renalware/patients/height_validator.rb b/app/validators/renalware/patients/height_validator.rb index abc1234..def5678 100644 --- a/app/validators/renalware/patients/height_validator.rb +++ b/app/validators/renalware/patients/height_validator.rb @@ -3,7 +3,7 @@ class HeightValidator < ActiveModel::EachValidator include NumericRangeValidations include NumericScaleValidations - MIN_VALUE = 0.05 + MIN_VALUE = 0.20 MAX_VALUE = 2.50 MAX_DECIMAL_PLACES = 2
Change HeightValidator min value to 0.20m
diff --git a/lib/yubioath.rb b/lib/yubioath.rb index abc1234..def5678 100644 --- a/lib/yubioath.rb +++ b/lib/yubioath.rb @@ -30,8 +30,7 @@ Put.new(@card).call(name: name, secret: secret, algorithm: algorithm, type: type, digits: digits) end - def reset(confirm: false) - return false unless confirm + def reset Reset.new(@card).call end end
Remove the silly reset confirmation
diff --git a/lib/tasks/db/fix_world_records.rake b/lib/tasks/db/fix_world_records.rake index abc1234..def5678 100644 --- a/lib/tasks/db/fix_world_records.rake +++ b/lib/tasks/db/fix_world_records.rake @@ -12,7 +12,7 @@ maps = Score.distinct.pluck(:map).sort progress = ProgressBar.create(total: maps.length * 4) maps.each do |map| - (0..3).each do |mode| + 4.times do |mode| progress.increment s = Score.where(map: map, mode: mode).order(:time, :updated_at).first next if s.nil?
Use 4.times instead of (0..3).each (Style/EachForSimpleLoop)
diff --git a/rubyonrails/notejam/app/controllers/pad_controller.rb b/rubyonrails/notejam/app/controllers/pad_controller.rb index abc1234..def5678 100644 --- a/rubyonrails/notejam/app/controllers/pad_controller.rb +++ b/rubyonrails/notejam/app/controllers/pad_controller.rb @@ -2,12 +2,10 @@ before_action :authenticate_user def create if params[:pad] - @pad = current_user.pads.create(pad_params) - if @pad.valid? + @pad = Pad.new(pad_params.merge(user: current_user)) + if @pad.save redirect_to url_for(:all_notes), flash: { success: 'Pad is successfully created' } end - # @TODO fix this weirdness - current_user.pads.delete(@pad) end end
Rails: Fix pad creation (remove explicit pad deletion from association).
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -1,18 +1,6 @@ # --- Install packages we need --- -package 'php5-cgi' +package 'php5-fpm' -# --- Deploy a configuration file --- -# For longer files, when using 'content "..."' becomes too -# cumbersome, we can resort to deploying separate files: -cookbook_file '/etc/init.d/php-fastcgi' do - source "php-fastcgi.d" - mode "0777" -end - -execute "start-php-fastcgi" do - command "/etc/init.d/php-fastcgi start" -end - -execute "install-php-as-service" do - command "update-rc.d php-fastcgi defaults" +execute "start-php5-fpm" do + command "/etc/init.d/php5-fpm start" end
Configure recipe to deploy php5-fpm
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -4,7 +4,7 @@ version = node.graylog2[:major_version] if platform?('centos') - repository_file = "graylog2-#{version}-repository-centos6_latest.rpm" + repository_file = "graylog2-#{version}-repository-el6_latest.rpm" elsif platform?('ubuntu') repository_file = "graylog2-#{version}-repository-ubuntu14.04_latest.deb" elsif platform?('debian') @@ -13,7 +13,7 @@ remote_file "#{Chef::Config[:file_cache_path]}/#{repository_file}" do action :create_if_missing - source "http://packages.graylog2.org/repo/packages/#{repository_file}" + source "https://packages.graylog2.org/repo/packages/#{repository_file}" end execute 'apt-update' do
Access package repo via https. Also use the el6 package instead of centos6.
diff --git a/lib/chef/knife/vault_rotate_all_keys.rb b/lib/chef/knife/vault_rotate_all_keys.rb index abc1234..def5678 100644 --- a/lib/chef/knife/vault_rotate_all_keys.rb +++ b/lib/chef/knife/vault_rotate_all_keys.rb @@ -0,0 +1,57 @@+# Description: Chef-Vault VaultRotateAllKeys class +# Copyright 2013, Nordstrom, Inc. + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'chef/knife/vault_base' + +class Chef + class Knife + class VaultRotateAllKeys < Knife + + include Chef::Knife::VaultBase + + banner "knife vault rotate all keys" + + def run + set_mode(config[:mode]) + rotate_all_keys + end + + private + + def rotate_all_keys + vaults = Chef::DataBag.list.keys + vaults.each { |vault| rotate_vault_keys(vault) } + end + + def rotate_vault_keys(vault) + vault_items(vault).each do |item| + rotate_vault_item_keys(vault, item) + end + end + + def vault_items(vault) + Chef::DataBag.load(vault).keys.inject([]) do |array, key| + array << key.sub('_keys', '') if key.match(/.+_keys$/) + array + end + end + + def rotate_vault_item_keys(vault, item) + puts "Rotating keys for: #{vault} #{item}" + ChefVault::Item.load(vault, item).rotate_keys! + end + end + end +end
Add rotate all keys command This will rotate keys for all existing vaults and items.
diff --git a/resources/config.rb b/resources/config.rb index abc1234..def5678 100644 --- a/resources/config.rb +++ b/resources/config.rb @@ -15,6 +15,6 @@ action :create do require 'toml-rb' converge_if_changed do - ::IO.write(path, ::TomlRB::Generator.new(config).body) + ::IO.write(path, ::TomlRB.dump(config)) end end
Fix dump in new gem toml-rb
diff --git a/spec/controllers/club_applications_controller_spec.rb b/spec/controllers/club_applications_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/club_applications_controller_spec.rb +++ b/spec/controllers/club_applications_controller_spec.rb @@ -2,9 +2,9 @@ RSpec.describe ClubApplicationsController, type: :controller do describe 'POST #create' do - let(:params) { FactoryGirl.attributes_for(:club_application) } + let(:params) { attributes_for(:club_application) } let(:invalid_params) { - FactoryGirl.attributes_for(:club_application_with_no_high_school) } + attributes_for(:club_application_with_no_high_school) } context 'with valid fields' do it 'saves the new application to the database' do
Remove references to FactoryGirl in tests.
diff --git a/spec/requests/api/v1/api_v1_partner_approvals_spec.rb b/spec/requests/api/v1/api_v1_partner_approvals_spec.rb index abc1234..def5678 100644 --- a/spec/requests/api/v1/api_v1_partner_approvals_spec.rb +++ b/spec/requests/api/v1/api_v1_partner_approvals_spec.rb @@ -0,0 +1,50 @@+require 'rails_helper' + +RSpec.describe "API::V1::PartnerApprovals", type: :request do + describe "POST /api/v1/partner_approvals" do + let!(:partner) { create(:partner) } + + context "with a valid API key" do + subject do + headers = { + "ACCEPT" => "application/json", + "X-Api-Key" => ENV["PARTNER_KEY"] + } + + params = { + partner: { + diaper_partner_id: partner.id + } + } + + post api_v1_partner_approvals_path, params: params, headers: headers + end + + it "returns HTTP created" do + subject + expect(response).to have_http_status(:ok) + end + end + + context "without a valid API key" do + before do + headers = { + "ACCEPT" => "application/json", + "X-Api-Key" => "not_valid" + } + + params = { + request: { + diaper_partner_id: partner.id + } + } + + post api_v1_partner_approvals_path, params: params, headers: headers + end + + it "returns HTTP forbidden" do + expect(response).to have_http_status(:forbidden) + end + end + end +end
Add missing v1 partner approvals controller spec
diff --git a/lib/railsd/subscribers/active_record.rb b/lib/railsd/subscribers/active_record.rb index abc1234..def5678 100644 --- a/lib/railsd/subscribers/active_record.rb +++ b/lib/railsd/subscribers/active_record.rb @@ -14,10 +14,10 @@ runtime = ((ending - start) * 1_000).round name = payload[:name] sql = payload[:sql].to_s.strip + operation = sql.split(' ', 2).first.to_s.downcase timing "active_record.sql", runtime - operation = sql.split(' ', 2).first.to_s.downcase case operation when "begin" timing "active_record.sql.transaction_begin", runtime
Move operation assignment near other assignments.
diff --git a/lib/travis/api/v3/services/job/debug.rb b/lib/travis/api/v3/services/job/debug.rb index abc1234..def5678 100644 --- a/lib/travis/api/v3/services/job/debug.rb +++ b/lib/travis/api/v3/services/job/debug.rb @@ -17,7 +17,7 @@ { debug: { stage: 'before_install', - previous_status: 'failed', + previous_state: job.state, created_by: access_control.user.login } }
Fix previous_status → previous_state, and set value correctly
diff --git a/subtle.gemspec b/subtle.gemspec index abc1234..def5678 100644 --- a/subtle.gemspec +++ b/subtle.gemspec @@ -19,6 +19,7 @@ gem.add_runtime_dependency 'blankslate' gem.add_development_dependency 'mocha' gem.add_development_dependency 'rake' + gem.add_development_dependency 'minitest' gem.add_development_dependency 'coveralls' gem.add_development_dependency 'minitest' end
Add minitest in an effort to get ree tests to pass.
diff --git a/cookbooks/nagios/recipes/client_package.rb b/cookbooks/nagios/recipes/client_package.rb index abc1234..def5678 100644 --- a/cookbooks/nagios/recipes/client_package.rb +++ b/cookbooks/nagios/recipes/client_package.rb @@ -18,11 +18,21 @@ # limitations under the License. # -%w{ - nagios-nrpe-server - nagios-plugins - nagios-plugins-basic - nagios-plugins-standard -}.each do |pkg| - package pkg +case platform +when "centos" "redhat" "fedora" "amazon" "scientific" + %w{ + nrpe + nagios-plugins + }.each do |pkg| + package pkg + end +else + %w{ + nagios-nrpe-server + nagios-plugins + nagios-plugins-basic + nagios-plugins-standard + }.each do |pkg| + package pkg + end end
Add support for install NRPE via package on CentOS and similar systems
diff --git a/cookbooks/wt_heatmaps/recipes/apiserver.rb b/cookbooks/wt_heatmaps/recipes/apiserver.rb index abc1234..def5678 100644 --- a/cookbooks/wt_heatmaps/recipes/apiserver.rb +++ b/cookbooks/wt_heatmaps/recipes/apiserver.rb @@ -7,7 +7,8 @@ # All rights reserved - Do Not Redistribute # -package "heatmaps_#{node['wt_heatmaps']['heatmaps_version']}_amd64.deb" do +package "heatmaps" do + version "#{node['wt_heatmaps']['heatmaps_version']}" action :install end
Fix package resource for wt_heatmaps to actually install Former-commit-id: 19388ce6131744f45fb33c45adaa58f9584070f5 [formerly 582a6e63ccf7386a01418923038542e2a7523fde] [formerly a056bed97691d8edbeb921383be768afc016d8bf [formerly a9e994a8098b273d45522f3f986ee2d2016d1a9d [formerly c0c1a7c7b48512549f03f52f79b1ad24eae5e713]]] Former-commit-id: 68eedacadd84973f3be8a4975e28a48e6e14d24f [formerly 16c6606a8080b9afbef04f028f81276cb271ba58] Former-commit-id: d257e082e2d5d159ad2732c3ec584c75c1cc8a67 Former-commit-id: 8d0b1e8ee9c850bee4f9d1c741808a6b17d99131
diff --git a/api/app/controllers/spree/api/inventory_units_controller.rb b/api/app/controllers/spree/api/inventory_units_controller.rb index abc1234..def5678 100644 --- a/api/app/controllers/spree/api/inventory_units_controller.rb +++ b/api/app/controllers/spree/api/inventory_units_controller.rb @@ -34,7 +34,7 @@ unless inventory_unit.respond_to?(can_event) && inventory_unit.send(can_event) render :text => { :exception => "cannot transition to #{@event}" }.to_json, - :status => 200 + :status => 200 false end end
[api] Move InventoryUnitsController to correct location
diff --git a/mementus.gemspec b/mementus.gemspec index abc1234..def5678 100644 --- a/mementus.gemspec +++ b/mementus.gemspec @@ -8,8 +8,8 @@ spec.version = Mementus::VERSION spec.authors = ["maetl"] spec.email = ["me@maetl.net"] - spec.description = %q{In-memory data model} - spec.summary = %q{In-memory data model} + spec.description = "Graph data structure toolkit." + spec.summary = "Graph data structure toolkit for Ruby applications." spec.homepage = "https://github.com/maetl/mementus" spec.license = "MIT"
Update description and summary in gemspec
diff --git a/bin/pre_runner_boot.rb b/bin/pre_runner_boot.rb index abc1234..def5678 100644 --- a/bin/pre_runner_boot.rb +++ b/bin/pre_runner_boot.rb @@ -9,5 +9,3 @@ Rails.configuration.cache_classes = true Dotenv.load if ENV['APP_SECRET_TOKEN'].blank? - -require 'agent_runner'
Allow to create `LongRunnable` Agent gems Instead of explicitly requiring `agent_runner`, reply on the Rails autoloader. This prevents the file being loaded twice if a Agent gem uses `LongRunnable::Worker`. Inheriting triggers auto loading of the `AgentRunner` class very early in the boot process. This initializes the long runnable Agent registry and fills the `@@agents` array with all LongRunnable agents. When `lib/agent_runner` was then required again in `bin/pre_runner_boot.rb`, the class is re-loaded and the long runnable Agent registry was empty. #2704
diff --git a/app/controllers/api/v1/api_application_controller.rb b/app/controllers/api/v1/api_application_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/api_application_controller.rb +++ b/app/controllers/api/v1/api_application_controller.rb @@ -18,8 +18,10 @@ private def restrict_access - api_key = ApiKey.find_by_access_token(params[:access_token]) - head :unauthorized unless api_key + unless current_user + api_key = ApiKey.find_by_access_token(params[:access_token]) + head :unauthorized unless api_key + end end end end
Allow a currently logged in user to interact with api without key
diff --git a/test/functional/login_controller_test.rb b/test/functional/login_controller_test.rb index abc1234..def5678 100644 --- a/test/functional/login_controller_test.rb +++ b/test/functional/login_controller_test.rb @@ -1,4 +1,5 @@ context "A user" do + use_controller LoginController fixtures :users, :companies, :customers setup do @@ -8,7 +9,6 @@ specify "is required to log in" do use_controller ActivitiesController - get :list response.should.redirect :controller => 'login', :action => 'login' end @@ -28,6 +28,11 @@ should.redirect end + specify "should not login without username and password" do + post :validate, :user => { 'username' => '', 'password' => '' } + should.redirect_to :controller => 'login', :action => 'login' + end + specify "should be able to log in" do post :validate, :user => { 'username' => 'test', 'password' => 'password' } should.redirect_to :controller => 'activities', :action => 'list'
Test for checking empty username/password
diff --git a/test/integration/session_answers_test.rb b/test/integration/session_answers_test.rb index abc1234..def5678 100644 --- a/test/integration/session_answers_test.rb +++ b/test/integration/session_answers_test.rb @@ -27,7 +27,7 @@ end test "Returning to start of flow resets session" do - visit "coronavirus-find-support/s" + visit "find-coronavirus-support/s" within "legend" do assert_page_has_content "What do you need help with because of coronavirus?" end @@ -36,7 +36,7 @@ within "legend" do assert_page_has_content "Do you feel safe where you live?" end - visit "coronavirus-find-support/s" + visit "find-coronavirus-support/s" within "legend" do assert_page_has_content "What do you need help with because of coronavirus?" end
Fix urls Session Answers integration test Test was merged in after renaming of find coronavirus support flow name, and has old name.
diff --git a/bukkit.gemspec b/bukkit.gemspec index abc1234..def5678 100644 --- a/bukkit.gemspec +++ b/bukkit.gemspec @@ -22,7 +22,7 @@ spec.add_runtime_dependency('archive-zip') spec.add_runtime_dependency('colorize') spec.add_runtime_dependency('commander') - spec.add_runtime_dependency('json') + spec.add_runtime_dependency('multi_json') spec.add_runtime_dependency('launchy') spec.add_runtime_dependency('curb')
Add multi_json as a dependency.
diff --git a/db/migrate/20190207000150_change_user_id_to_bigint.rb b/db/migrate/20190207000150_change_user_id_to_bigint.rb index abc1234..def5678 100644 --- a/db/migrate/20190207000150_change_user_id_to_bigint.rb +++ b/db/migrate/20190207000150_change_user_id_to_bigint.rb @@ -0,0 +1,9 @@+class ChangeUserIdToBigint < ActiveRecord::Migration[6.0] + def up + change_column :users, :id, :bigint + end + + def down + change_column :users, :id, :integer + end +end
Update user_id primary key to bigint
diff --git a/config/initializers/async_helper.rb b/config/initializers/async_helper.rb index abc1234..def5678 100644 --- a/config/initializers/async_helper.rb +++ b/config/initializers/async_helper.rb @@ -1,15 +1,4 @@ class ActiveRecord::Base - - # Creates a async_<methodname> method that - # enqueues the corresponding method call. - def self.async_method(*methods) - methods.each do |method| - define_method "async_#{method}" do |*args| - async method, *args - end - end - end - def self.async(method, *args) async_in 'class', 1, method.to_s, *args end @@ -29,5 +18,4 @@ 'args' => [type, self.to_s, *args], 'at' => (at < 1_000_000_000 ? Time.now + at : at).to_f end - end
Refactor AsyncHelper: Remove unused async_method.
diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index abc1234..def5678 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -4,4 +4,13 @@ # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. -Fairytale::Application.config.secret_token = '19fc3f26a387505fbb89ded2e1a1675f211f00329d29278d544576a9e88dcc273313b1ed981542bda8131293288bc8c11e00e85e88967d4919f6866bc2141f10' + +if Rails.env.production? + Fairytale::Application.config.secret_token = ENV['RAILS_SECRET_TOKEN'] + if Fairytale::Application.config.secret_token.blank? + Rails.logger.warn('Please configure RAILS_SECRET_TOKEN in your environment. See docs/deployment.md for details.') + exit -1 + end +else + Fairytale::Application.config.secret_token = '19fc3f26a387505fbb89ded2e1a1675f211f00329d29278d544576a9e88dcc273313b1ed981542bda8131293288bc8c11e00e85e88967d4919f6866bc2141f10' +end
Read secret token from environment in production. When in production we would like to read the secret token from the environment so we can keep reusing the values between deploys without having to commit it to a public repository.
diff --git a/app/controllers/group/message_threads_controller.rb b/app/controllers/group/message_threads_controller.rb index abc1234..def5678 100644 --- a/app/controllers/group/message_threads_controller.rb +++ b/app/controllers/group/message_threads_controller.rb @@ -21,12 +21,6 @@ end end - def show - load_thread - @messages = @thread.messages - @new_message = @thread.messages.build - end - protected def load_group
Remove extraneous show action from group threads controller, handled by parent.
diff --git a/app/controllers/spree/admin/relations_controller.rb b/app/controllers/spree/admin/relations_controller.rb index abc1234..def5678 100644 --- a/app/controllers/spree/admin/relations_controller.rb +++ b/app/controllers/spree/admin/relations_controller.rb @@ -45,7 +45,7 @@ end def load_data - @product = Spree::Product.find_by_slug(params[:product_id]) + @product = Spree::Product.friendly.find(params[:product_id]) end def model_class
Use friendly_id to find the product in RelationsController Fixes #86
diff --git a/app/models/renalware/pathology/view_observations.rb b/app/models/renalware/pathology/view_observations.rb index abc1234..def5678 100644 --- a/app/models/renalware/pathology/view_observations.rb +++ b/app/models/renalware/pathology/view_observations.rb @@ -31,9 +31,8 @@ end def determine_date_range_for_observations(observations) - relation = ObservationDateRange.new( - DetermineDateRangeQuery.new(relation: observations, limit: @limit) - ).call + observations = DetermineDateRangeQuery.new(relation: observations, limit: @limit).call + ObservationDateRange.new(relation: observations).call end def filter_observations_within_date_range(observations, date_range)
Correct call site for ObservationDateRange
diff --git a/process_results.rb b/process_results.rb index abc1234..def5678 100644 --- a/process_results.rb +++ b/process_results.rb @@ -12,7 +12,7 @@ puts data.pretty_inspect data["Result"].each do |result| - benchmark_title = "#{result["Title"].first}" + benchmark_title = "#{result["Title"].first} #{result["Arguments"].first}" fname = "benchmark-results-all.csv" unless File.exist? fname open(fname, "a") { |out_csv|
Include the arguments in the benchmark as the title is not unique.
diff --git a/FreeStreamer.podspec b/FreeStreamer.podspec index abc1234..def5678 100644 --- a/FreeStreamer.podspec +++ b/FreeStreamer.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'FreeStreamer' - s.version = '1.5.2' + s.version = '1.5.3' s.license = 'BSD' s.summary = 'A low-memory footprint streaming audio client for iOS and OS X.' s.homepage = 'http://freestreamer.io'
Bump the version to 1.5.3.
diff --git a/abstract_type.gemspec b/abstract_type.gemspec index abc1234..def5678 100644 --- a/abstract_type.gemspec +++ b/abstract_type.gemspec @@ -12,7 +12,7 @@ gem.homepage = 'https://github.com/dkubb/abstract_type' gem.files = `git ls-files`.split($/) - gem.test_files = `git ls-files -- {spec}/*`.split($/) + gem.test_files = `git ls-files -- spec/unit`.split($/) gem.extra_rdoc_files = %w[LICENSE README.md TODO] gem.add_runtime_dependency('backports', '~> 2.8.2')
Change test files in gemspec to be more explicit
diff --git a/cookbooks/wt_streamingmanagementservice/recipes/undeploy.rb b/cookbooks/wt_streamingmanagementservice/recipes/undeploy.rb index abc1234..def5678 100644 --- a/cookbooks/wt_streamingmanagementservice/recipes/undeploy.rb +++ b/cookbooks/wt_streamingmanagementservice/recipes/undeploy.rb @@ -9,6 +9,8 @@ log_dir = "#{node['wt_common']['log_dir_linux']}/streamingmanagementservice" install_dir = "#{node['wt_common']['install_dir_linux']}/streamingmanagementservice" +sv_dir = "/etc/sv/streamingmanagementservice" +service_dir = "/etc/service/streamingmanagementservice" runit_service "streamingmanagementservice" do action :disable @@ -28,4 +30,15 @@ directory install_dir do recursive true action :delete -end+end + +directory sv_dir do + recursive true + action :delete +end + +directory service_dir do + recursive true + action: delete +end +
Stabilize sms deployment. Eliminates service start returning (1) error.