diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/plugins/commands/plugin/command/mixin_install_opts.rb b/plugins/commands/plugin/command/mixin_install_opts.rb index abc1234..def5678 100644 --- a/plugins/commands/plugin/command/mixin_install_opts.rb +++ b/plugins/commands/plugin/command/mixin_install_opts.rb @@ -11,15 +11,6 @@ o.on("--entry-point NAME", String, "The name of the entry point file for loading the plugin.") do |entry_point| options[:entry_point] = entry_point - end - - # @deprecated - o.on("--plugin-prerelease", - "Allow prerelease versions of this plugin.") do |plugin_prerelease| - puts "--plugin-prelease is deprecated and will be removed in the next" - puts "version of Vagrant. It has no effect now. Use the '--plugin-version'" - puts "flag to get a specific pre-release version." - puts end o.on("--plugin-clean-sources",
Remove deprecated plugin install option
diff --git a/lib/cloudstrap/hdp/bootstrap_properties.rb b/lib/cloudstrap/hdp/bootstrap_properties.rb index abc1234..def5678 100644 --- a/lib/cloudstrap/hdp/bootstrap_properties.rb +++ b/lib/cloudstrap/hdp/bootstrap_properties.rb @@ -2,6 +2,7 @@ require 'java-properties' require_relative '../config' +require_relative '../seed_properties' module StackatoLKG module HDP @@ -42,6 +43,11 @@ private + Contract None => ::Cloudstrap::SeedProperties + def seed + @seed ||= ::Cloudstrap::SeedProperties.new + end + Contract None => Bool def exist? File.exist?(file)
Add support for seed to BootstrapProperties
diff --git a/lib/memory/persistence/atom_persistence.rb b/lib/memory/persistence/atom_persistence.rb index abc1234..def5678 100644 --- a/lib/memory/persistence/atom_persistence.rb +++ b/lib/memory/persistence/atom_persistence.rb @@ -3,7 +3,7 @@ class AtomPersistence def persist(collection) collection.items.each_with_object([]) do |object, result| - next if event_already_in(object.id.content) + next if event_exists?(object.id.content) event = Memory::Models::Event.new.tap do |e| e.guid = object.id.content @@ -20,7 +20,7 @@ private - def event_already_in(event_id) + def event_exists?(event_id) Memory::Models::Event.with(:guid, event_id) end end
Improve legibility of method name.
diff --git a/lib/metric_fu/metrics/reek/reek_grapher.rb b/lib/metric_fu/metrics/reek/reek_grapher.rb index abc1234..def5678 100644 --- a/lib/metric_fu/metrics/reek/reek_grapher.rb +++ b/lib/metric_fu/metrics/reek/reek_grapher.rb @@ -38,7 +38,7 @@ def data @reek_count.map do |name, count| - [name, count.join(',')] + [name, nil_counts_to_zero(count).join(',')] end end @@ -46,5 +46,11 @@ 'reek.js' end + private + + def nil_counts_to_zero(counts) + counts.map { |count| count || 0 } + end + end end
Fix highcharts error when plotting empty data values
diff --git a/lib/scss_lint/linter/space_before_brace.rb b/lib/scss_lint/linter/space_before_brace.rb index abc1234..def5678 100644 --- a/lib/scss_lint/linter/space_before_brace.rb +++ b/lib/scss_lint/linter/space_before_brace.rb @@ -6,13 +6,9 @@ def visit_root(node) engine.lines.each_with_index do |line, index| line.scan /[^"#](?<![^ ] )\{/ do |match| - @lints << Lint.new(engine.filename, index + 1, description) + add_lint(index + 1, 'Opening curly braces ({) should be preceded by one space') end end end - - def description - 'Opening curly braces ({) should be preceded by one space' - end end end
Remove description method from SpaceBeforeBrace The `description` method is being deprecated. While here, also changed from appending to the `@lints` instance variable directly to using the `add_lint` helper. Change-Id: If2902858e2cd29c06759294c4d6357690aec6017 Reviewed-on: http://gerrit.causes.com/36725 Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com> Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
diff --git a/lib/tasks/photos.rake b/lib/tasks/photos.rake index abc1234..def5678 100644 --- a/lib/tasks/photos.rake +++ b/lib/tasks/photos.rake @@ -11,6 +11,7 @@ desc 'Process any photos run since ' task :process => :environment do Original.pending.each do |original| + puts Logger.info "Enqueing #{original.key}" Resque.enqueue Original, original.key end end
Add logging to photo processing
diff --git a/libraries/matchers.rb b/libraries/matchers.rb index abc1234..def5678 100644 --- a/libraries/matchers.rb +++ b/libraries/matchers.rb @@ -0,0 +1,25 @@+# -*- coding: utf-8 -*- +# +# Cookbook Name:: bamboo-agent +# Library:: matchers +# +# Copyright 2014, Numergy +# +# 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. +# + +if defined?(ChefSpec) + def install_bamboo_agent(resource_name) + ChefSpec::Matchers::ResourceMatcher.new(:bamboo_agent_install, :run, resource_name) + end +end
Add missing matcher for bamboo_agent_install resource
diff --git a/libraries/matchers.rb b/libraries/matchers.rb index abc1234..def5678 100644 --- a/libraries/matchers.rb +++ b/libraries/matchers.rb @@ -7,6 +7,8 @@ rbenv_rehash: [:run], rbenv_ruby: [:install, :reinstall], rbenv_script: [:run], + rbenv_system_install: [:install], + rbenv_user_install: [:install], }.each do |resource, actions| actions.each do |action| define_method("#{action}_#{resource}") do |name|
Add chefspec matcher for rbenv install
diff --git a/spec/features/add_authors_spec.rb b/spec/features/add_authors_spec.rb index abc1234..def5678 100644 --- a/spec/features/add_authors_spec.rb +++ b/spec/features/add_authors_spec.rb @@ -10,7 +10,6 @@ end scenario "Author specifies contributing authors" do - pending edit_paper = EditPaperPage.visit paper edit_paper.view_card 'Add Authors' do |overlay|
Remove pending; this test is passing
diff --git a/spec/features/new_project_spec.rb b/spec/features/new_project_spec.rb index abc1234..def5678 100644 --- a/spec/features/new_project_spec.rb +++ b/spec/features/new_project_spec.rb @@ -25,8 +25,6 @@ end it "automatically adds all files to local Git repo and makes an initial commit" do - `git config user.email "test@ci.org"` - `git config user.name "CI Tester"` git_opts = "--git-dir=#{project_path}/.git" git_opts << " --work-tree=#{project_path}"
Remove setting of Git identity
diff --git a/lib/openlogi/stock.rb b/lib/openlogi/stock.rb index abc1234..def5678 100644 --- a/lib/openlogi/stock.rb +++ b/lib/openlogi/stock.rb @@ -8,5 +8,9 @@ property :quantity, coerce: Integer property :size, coerce: Enum[:SS, :S, :M, :L, :LL, :'3L'] property :weight, coerce: Integer + property :backordered, coerce: Integer + property :created_at, coerce: DateTime + property :updated_at, coerce: DateTime + property :reserved, coerce: Integer end end
Add some missing properties on Stock
diff --git a/spec/features/server_sends_daily_email_prompt_spec.rb b/spec/features/server_sends_daily_email_prompt_spec.rb index abc1234..def5678 100644 --- a/spec/features/server_sends_daily_email_prompt_spec.rb +++ b/spec/features/server_sends_daily_email_prompt_spec.rb @@ -7,7 +7,7 @@ third_user = create(:user) users = [first_user, second_user, third_user] - PromptTask.new(users, PromptWorker).run + PromptTask.new(User.pluck(:id), PromptWorker).run users.each do |user| expect(emailed_addresses).to include(user.email)
Fix test to match how the task is actually used
diff --git a/spec/requests/paper_trail_spec.rb b/spec/requests/paper_trail_spec.rb index abc1234..def5678 100644 --- a/spec/requests/paper_trail_spec.rb +++ b/spec/requests/paper_trail_spec.rb @@ -0,0 +1,17 @@+require 'rails_helper' + +RSpec.describe 'paper trail' do + context 'when updating something' do + let(:user) { FactoryBot.create(:user, site: site) } + let(:request_method) { :put } + let(:request_path) { '/site' } + let(:request_params) { { 'site' => { 'name' => new_name } } } + + it 'records who made the edit' do + request_page(expected_status: 302) + + site = Site.find_by!(name: new_name) + expect(site.versions.last.whodunnit).to eq user.id.to_s + end + end +end
Add request spec for PaperTrail Resolves #907
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,12 +3,13 @@ config.fog_credentials = { provider: 'AWS', aws_access_key_id: Configuration[:aws_access_key], - aws_secret_access_key: Configuration[:aws_secret_key] + aws_secret_access_key: Configuration[:aws_secret_key], + region: Configuration[:aws_region] } config.fog_directory = Configuration[:aws_bucket] config.fog_attributes = { 'Cache-Control' => 'max-age=315576000' } # optional, defaults to { } config.asset_host = Configuration[:asset_host] - config.fog_region = Configuration[:aws_region] + #config.fog_region = Configuration[:aws_region] else config.enable_processing = false if Rails.env.test? or Rails.env.cucumber? end
Add Fog Region When upload
diff --git a/spec/models/spree/calculator/price_sack_spec.rb b/spec/models/spree/calculator/price_sack_spec.rb index abc1234..def5678 100644 --- a/spec/models/spree/calculator/price_sack_spec.rb +++ b/spec/models/spree/calculator/price_sack_spec.rb @@ -8,6 +8,13 @@ calculator.preferred_discount_amount = 1 calculator end + let(:floatCalculator) do + floatCalculator = Spree::Calculator::PriceSack.new + floatCalculator.preferred_minimal_amount = 5 + floatCalculator.preferred_normal_amount = 10.4 + floatCalculator.preferred_discount_amount = 1.2 + floatCalculator + end let(:line_item) { build(:line_item, price: price, quantity: 2) } @@ -16,6 +23,11 @@ it "uses the preferred normal amount" do expect(calculator.compute(line_item)).to eq(10) end + context "and preferred normal amount is float" do + it "uses the float preferred normal amount" do + expect(floatCalculator.compute(line_item)).to eq(10.4) + end + end end context 'when the order amount is above preferred minimal' do @@ -23,6 +35,11 @@ it "uses the preferred discount amount" do expect(calculator.compute(line_item)).to eq(1) end + context "and preferred discount amount is float" do + it "uses the float preferred discount amount" do + expect(floatCalculator.compute(line_item)).to eq(1.2) + end + end end context "extends LocalizedNumber" do
Add Price Sack Spec for Float Amounts
diff --git a/lib/subway/request.rb b/lib/subway/request.rb index abc1234..def5678 100644 --- a/lib/subway/request.rb +++ b/lib/subway/request.rb @@ -14,6 +14,11 @@ def authenticated? false end + + def params + path_params.merge(query_params) + end + memoize :params def path_params raw.rack_env[ROUTER_PARAMS_RACK_ENV_KEY] @@ -43,6 +48,10 @@ include anima.add(:session) + def prepared(params) + Prepared.new(to_h.merge(params: params)) + end + def authenticated? true end @@ -51,5 +60,9 @@ session.cookie end end # class Authenticated + + class Prepared < Authenticated + include anima.add(:params) + end end # class Request end # module Subway
Add Request::Prepared for wrapping sanitized params This is not yet optimal but works for now
diff --git a/lib/tasks/jumpup.rake b/lib/tasks/jumpup.rake index abc1234..def5678 100644 --- a/lib/tasks/jumpup.rake +++ b/lib/tasks/jumpup.rake @@ -1,11 +1,3 @@-namespace :jumpup do - namespace :heroku do - task :open do - system('heroku open') - end - end -end - INTEGRATION_TASKS = %w( jumpup:heroku:start jumpup:start @@ -14,5 +6,4 @@ spec jumpup:finish jumpup:heroku:finish - jumpup:heroku:open )
Revert "open heroku app after deploy" This reverts commit 0f1b9466d35b8bc86b83da3f799354d59ad332b1.
diff --git a/lib/travis/logs/config.rb b/lib/travis/logs/config.rb index abc1234..def5678 100644 --- a/lib/travis/logs/config.rb +++ b/lib/travis/logs/config.rb @@ -8,7 +8,7 @@ logs_database: { adapter: 'postgresql', database: "travis_logs_#{Travis.env}", encoding: 'unicode', min_messages: 'warning' }, s3: { hostname: 'archive.travis-ci.org', access_key_id: '', secret_access_key: '', acl: :public_read }, pusher: { app_id: 'app-id', key: 'key', secret: 'secret', secure: false }, - sidekiq: { namespace: 'sidekiq', pool_size: 3 }, + sidekiq: { namespace: 'sidekiq', pool_size: 7 }, logs: { aggregate_async: false, archive: true, purge: false, threads: 10, per_aggregate_limit: 500, intervals: { vacuum: 10, regular: 180, force: 3 * 60 * 60, purge: 6 } }, redis: { url: 'redis://localhost:6379' }, metrics: { reporter: 'librato' },
Increase default sidekiq pool_size to 7 The sidekiq gem is requesting a larger pool size and is crashing the dyno when that condition is not satisfied.
diff --git a/subversion/bindings/swig/ruby/test/run-test.rb b/subversion/bindings/swig/ruby/test/run-test.rb index abc1234..def5678 100644 --- a/subversion/bindings/swig/ruby/test/run-test.rb +++ b/subversion/bindings/swig/ruby/test/run-test.rb @@ -13,4 +13,8 @@ $LOAD_PATH.unshift(ext_dir) $LOAD_PATH.unshift(Dir.pwd) -exit Test::Unit::AutoRunner.run(false, File.dirname($0)) +if Test::Unit::AutoRunner.respond_to?(:standalone?) + exit Test::Unit::AutoRunner.run($0, File.dirname($0)) +else + exit Test::Unit::AutoRunner.run(false, File.dirname($0)) +end
Support Test::Unit distributed in ruby 1.8.3. * subversion/bindings/swig/ruby/test/run-test.rb: Pass $0 instead of false as the first argument of Test::Unit::AutoRunner.run when using Test::Unit is the one that distributed in ruby 1.8.3.
diff --git a/vsftpd/metadata.rb b/vsftpd/metadata.rb index abc1234..def5678 100644 --- a/vsftpd/metadata.rb +++ b/vsftpd/metadata.rb @@ -14,7 +14,8 @@ supports 'centos' supports 'rhel' -depends 'openssl', '>= 4.2.0' +# depends 'openssl', '>= 4.2.0' +depends 'openssl' source_url 'https://github.com/TheSerapher/chef-vsftpd' if respond_to?(:source_url) issues_url 'https://github.com/TheSerapher/chef-vsftpd/issues' if respond_to?(:issues_url)
Comment out "depends 'openssl', '>= 4.2.0'" And replaced with "depends 'openssl'" The version constraint causes problems with chef-solo provisioning.
diff --git a/activegraphql.gemspec b/activegraphql.gemspec index abc1234..def5678 100644 --- a/activegraphql.gemspec +++ b/activegraphql.gemspec @@ -11,7 +11,7 @@ spec.summary = %q{Ruby client for GraphQL services} spec.description = %q{} - spec.homepage = 'https://github.com/wakoopa/active-graphql' + spec.homepage = 'https://github.com/wakoopa/activegraphql' spec.license = 'MIT' spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
Fix homepage config in gemspec
diff --git a/test/integration/default/inspec/default_spec.rb b/test/integration/default/inspec/default_spec.rb index abc1234..def5678 100644 --- a/test/integration/default/inspec/default_spec.rb +++ b/test/integration/default/inspec/default_spec.rb @@ -1,4 +1,4 @@-if os[:family] == 'redhat' && os[:release].start_with?('6') || os[:family] == 'amazon' +if (os[:family] == 'redhat' && os[:release].start_with?('6')) || os[:name] == 'amazon' describe command('sysctl -n kernel.msgmax') do its(:exit_status) { should eq 0 }
Fix inspec tests for Amazon Linux Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -1,5 +1,3 @@-$:<< File.expand_path('../../lib', __FILE__) - require 'minitest/autorun' require 'minitest/emoji' require 'pry'
Remove redundant addition to $LOAD_PATH
diff --git a/test/helper.rb b/test/helper.rb index abc1234..def5678 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -1,3 +1,6 @@+require 'simplecov' +SimpleCov.start + require 'rubygems' gem 'RedCloth', '>= 4.2.1'
Add SimpleCov to the unit tests
diff --git a/parallel_cucumber.gemspec b/parallel_cucumber.gemspec index abc1234..def5678 100644 --- a/parallel_cucumber.gemspec +++ b/parallel_cucumber.gemspec @@ -2,17 +2,19 @@ require "./lib/#{name}/version" Gem::Specification.new name, ParallelCucumber::VERSION do |spec| - spec.name = 'parallel_cucumber' - spec.authors = 'Alexander Bayandin' - spec.email = 'a.bayandin@gmail.com' - spec.summary = 'Run cucumber in parallel' + spec.name = name + spec.authors = ['Alexander Bayandin'] + spec.email = 'a.bayandin@gmail.com' + spec.summary = 'Run cucumber in parallel' spec.description = 'Our own parallel cucumber with queue and workers' - spec.homepage = 'https://github.com/badoo/parallel_cucumber' - spec.license = 'MIT' + spec.homepage = 'https://github.com/badoo/parallel_cucumber' + spec.license = 'MIT' - spec.files = Dir['{lib}/**/*.rb', 'bin/*', 'README.md'] - spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } + spec.files = Dir['{lib}/**/*.rb', 'bin/*', 'README.md'] + spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = 'lib' + + spec.required_ruby_version = '>= 2.2.2' # Inherited from runtime dependencies spec.add_runtime_dependency 'cucumber', '~> 2' spec.add_runtime_dependency 'parallel', '~> 1.12'
Add required_ruby_version to gemspec and clean it up
diff --git a/spec/commit_spec.rb b/spec/commit_spec.rb index abc1234..def5678 100644 --- a/spec/commit_spec.rb +++ b/spec/commit_spec.rb @@ -10,12 +10,12 @@ its(:__getobj__) { should be_a Grit::Commit } context "without a merge" do - its(:merge?) { should be_false } + it { should_not be_a_merge } end context "with a merge" do let(:sha) { "9d31467f6759c92f8535038c470d24a37ae93a9d" } - its(:merge?) { should be_true } + it { should be_a_merge } end context "net, additions, and deletions" do
Use Rspec predicate matcher syntax
diff --git a/spec/views/report/_form_expression_buttons.html.haml_spec.rb b/spec/views/report/_form_expression_buttons.html.haml_spec.rb index abc1234..def5678 100644 --- a/spec/views/report/_form_expression_buttons.html.haml_spec.rb +++ b/spec/views/report/_form_expression_buttons.html.haml_spec.rb @@ -0,0 +1,30 @@+describe 'report/_form_filter.html.haml' do + let(:report) { FactoryGirl.create(:miq_report) } + let(:exp_table) { [["Example AFTER \"value1\"", 1]] } + let(:expression) { {"after" => {"field" => "field_example", "value" => "value1"}, :token => 1} } + let(:edit) { { :rpt_id => report.id, :record_filter => {:exp_table => exp_table, :expression => expression}} } + + before do + assign(:expkey, :record_filter) + assign(:edit, edit) + end + + it 'renders form expression buttons for other report and Edit Display Filter button' do + render :partial => 'report/form_expression_buttons', + :locals => {:create_label => _('Create Display Filter'), + :display_label => _('Edit Display Filter')} + expect(rendered).to match(/Edit Display Filter/) + end + + context 'Create Display Filter button' do + let(:exp_table) { [["???", 1]] } + let(:expression) { {"???" => "???", :token => 1} } + + it 'renders form expression buttons for other report and Create Display Filter button' do + render :partial => 'report/form_expression_buttons', + :locals => {:create_label => _('Create Display Filter'), + :display_label => _('Edit Display Filter')} + expect(rendered).to match(/Create Display Filter/) + end + end +end
Add spec test for rendering form expression buttons Add spec test for fix in https://github.com/ManageIQ/manageiq-ui-classic/pull/3033, for rendering form expression buttons to display Filter tab properly, when editing report in Cloud Intel -> Reports -> Reports tab.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,10 +2,8 @@ require 'backports' require 'backports/basic_object' unless defined?(::BasicObject) -require 'devtools' +require 'devtools/spec_helper' require 'ice_nine' - -Devtools.init_spec_helper if ENV['COVERAGE'] == 'true' require 'simplecov'
Update spec helper to match current devtools conventions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -23,3 +23,24 @@ PuppetlabsSpec::Files.cleanup end end + +require 'pathname' +dir = Pathname.new(__FILE__).parent +Puppet[:modulepath] = File.join(dir, 'fixtures', 'modules') + +# There's no real need to make this version dependent, but it helps find +# regressions in Puppet +# +# 1. Workaround for issue #16277 where default settings aren't initialised from +# a spec and so the libdir is never initialised (3.0.x) +# 2. Workaround for 2.7.20 that now only loads types for the current node +# environment (#13858) so Puppet[:modulepath] seems to get ignored +# 3. Workaround for 3.5 where context hasn't been configured yet, +# ticket https://tickets.puppetlabs.com/browse/MODULES-823 +# +ver = Gem::Version.new(Puppet.version.split('-').first) +if Gem::Requirement.new("~> 2.7.20") =~ ver || Gem::Requirement.new("~> 3.0.0") =~ ver || Gem::Requirement.new("~> 3.5") =~ ver + puts "augeasproviders: setting Puppet[:libdir] to work around broken type autoloading" + # libdir is only a single dir, so it can only workaround loading of one external module + Puppet[:libdir] = "#{Puppet[:modulepath]}/augeasproviders_core/lib" +end
Use modulesync to manage meta files
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,10 +8,4 @@ config.treat_symbols_as_metadata_keys_with_true_values = true config.run_all_when_everything_filtered = true config.filter_run :focus - - # Run specs in random order to surface order dependencies. If you find an - # order dependency and want to debug it, you can fix the order by providing - # the seed, which is printed after each run. - # --seed 1234 - config.order = 'random' end
Stop running specs randomly for now. Randomness is taking away from readabilty and progression. Will bring back later.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -25,3 +25,12 @@ DatabaseCleaner.clean end end + +# def puts(*args) +# super(caller.join("\n")) +# super(args) +# end +# +# def p(*args) +# puts caller.join("\n") +# end
Add way to find loose puts/p statements in specs
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -3,15 +3,15 @@ require 'chunky_png' module PNGSuite - + def png_suite_file(kind, file) File.join(png_suite_dir(kind), file) end - + def png_suite_dir(kind) File.expand_path("./png_suite/#{kind}", File.dirname(__FILE__)) end - + def png_suite_files(kind, pattern = '*.png') Dir[File.join(png_suite_dir(kind), pattern)] end @@ -19,25 +19,25 @@ module ResourceFileHelper - + def resource_file(name) File.expand_path("./resources/#{name}", File.dirname(__FILE__)) - end - + end + def resource_data(name) data = nil - File.open(resource_file(name), 'rb') { |f| data = f.read } + File.open(resource_file(name), 'rb') { |f| data = f.read } data end - + def reference_canvas(name) ChunkyPNG::Canvas.from_file(resource_file("#{name}.png")) end - + def reference_image(name) ChunkyPNG::Image.from_file(resource_file("#{name}.png")) end - + def display(png) filename = resource_file('_tmp.png') png.save(filename) @@ -49,4 +49,8 @@ config.extend PNGSuite config.include PNGSuite config.include ResourceFileHelper + + config.expect_with :rspec do |c| + c.syntax = [:should, :expect] + end end
Allow both should and expect for now
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,12 @@ require 'simplecov' require 'simplecov-rcov' -SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter +class SimpleCov::Formatter::MergedFormatter + def format(result) + SimpleCov::Formatter::HTMLFormatter.new.format(result) + SimpleCov::Formatter::RcovFormatter.new.format(result) + end +end +SimpleCov.formatter = SimpleCov::Formatter::MergedFormatter SimpleCov.start do add_filter "/vendor/" add_filter "/spec/"
Revert "Just use the simplecov Rcov formatter for now to make CI happy" This reverts commit 5d132621801d0b9ad35ea3702f56a2869c45f0fd.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -12,22 +12,22 @@ require 'jabber_stub' class TestAgent < Uppercut::Agent - command 'hi' do |c| + command 'hi' do |c,args| c.instance_eval { @base.instance_eval { @called_hi = true } } c.send 'called hi' end - command /^hi/ do |c| + command /^hi/ do |c,args| c.instance_eval { @base.instance_eval { @called_hi_regex = true } } c.send 'called high regex' end - command /(good)?bye/ do |c,good| + command /(good)?bye/ do |c,args| @called_goodbye = true - c.send good ? "Good bye to you as well!" : "Rot!" + c.send args.first ? "Good bye to you as well!" : "Rot!" end - command 'wait' do |c| + command 'wait' do |c,args| @called_wait = true c.send 'Waiting...' c.wait_for do |reply|
Tweak for new dispatch system.
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index abc1234..def5678 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -14,3 +14,7 @@ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} SchemaComments.setup + +Dir.chdir(File.expand_path("../../spec/dummy", __FILE__)) do + system('RAILS_ENV=test bin/rake db:create') +end
Call rake db:create to create database for test
diff --git a/spec/support/carrierwave.rb b/spec/support/carrierwave.rb index abc1234..def5678 100644 --- a/spec/support/carrierwave.rb +++ b/spec/support/carrierwave.rb @@ -1,7 +1,7 @@ CarrierWave.root = 'tmp/tests/uploads' RSpec.configure do |config| - config.after(:suite) do + config.after(:each) do FileUtils.rm_rf('tmp/tests/uploads') end end
Clear Carrierwave upload after each test example
diff --git a/spec/winnow_spec.rb b/spec/winnow_spec.rb index abc1234..def5678 100644 --- a/spec/winnow_spec.rb +++ b/spec/winnow_spec.rb @@ -1,6 +1,21 @@ require 'spec_helper' describe Winnow::Fingerprinter do + describe '#initialize' do + it 'accepts :guarantee_threshold, :noise_threshold' do + fprinter = Winnow::Fingerprinter.new( + guarantee_threshold: 0, noise_threshold: 1) + expect(fprinter.guarantee_threshold).to eq 0 + expect(fprinter.noise_threshold).to eq 1 + end + + it 'accepts :t and :k' do + fprinter = Winnow::Fingerprinter.new(t: 0, k: 1) + expect(fprinter.guarantee_threshold).to eq 0 + expect(fprinter.noise_threshold).to eq 1 + end + end + describe '#fingerprints' do it 'hashes strings to get keys' do # if t = k = 1, then each character will become a fingerprint
Add tests for the constructor.
diff --git a/Casks/intellij-idea-ce-eap.rb b/Casks/intellij-idea-ce-eap.rb index abc1234..def5678 100644 --- a/Casks/intellij-idea-ce-eap.rb +++ b/Casks/intellij-idea-ce-eap.rb @@ -1,10 +1,19 @@ cask :v1 => 'intellij-idea-ce-eap' do - version '141.1192.2' - sha256 '18f8ecfa66e2e687cab6ddd844bde8996ecb54eb93279a8e8ce5e43a9aa6def3' + version '142.2491.4' + sha256 '280e852beecff74301ecd402aa07109e9387930693d9bfd6357fc327d401e776' - url "http://download.jetbrains.com/idea/ideaIC-#{version}.dmg" - homepage 'https://confluence.jetbrains.com/display/IDEADEV/IDEA+14.1+EAP' + url "https://download.jetbrains.com/idea/ideaIC-#{version}-custom-jdk-bundled.dmg" + name 'IntelliJ IDEA EAP :: CE' + homepage 'https://confluence.jetbrains.com/display/IDEADEV/IDEA+15+EAP' license :apache - app 'IntelliJ IDEA 14 CE EAP.app' + app 'IntelliJ IDEA 15 CE EAP.app' + + zap :delete => [ + '~/Library/Preferences/com.jetbrains.intellij.plist', + '~/Library/Application Support/IdeaIC15', + '~/Library/Preferences/IdeaIC15', + '~/Library/Caches/IdeaIC15', + '~/Library/Logs/IdeaIC15', + ] end
Update IntelliJ IDEA CE to EAP 15; version 142.2491.4.
diff --git a/test/unit/score_updater_job_test.rb b/test/unit/score_updater_job_test.rb index abc1234..def5678 100644 --- a/test/unit/score_updater_job_test.rb +++ b/test/unit/score_updater_job_test.rb @@ -20,7 +20,7 @@ assert_equal @user.daily_score, DailyScore.last end - test 'updates a new daily score' do + test 'updates a daily score' do score = DailyScore.create(user: @user, s: 10) @user.reload assert_equal @user.daily_score, score @@ -29,5 +29,6 @@ score.reload assert_equal score.score, 12 assert_equal @user.daily_score, score + assert_equal DailyScore.count, 1 end end
Check that updates do not create a new document
diff --git a/attributes/default.rb b/attributes/default.rb index abc1234..def5678 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -4,5 +4,10 @@ when 'rhel' default['jenkins_cookbook_ci']['ruby_packages'] = ['libxml2-devel', 'libxslt-devel'] default['rvm']['default_ruby'] = 'ruby-1.9.3' + default['rvm']['user_installs'] = [ + { 'user' => 'jenkins', + 'default_ruby' => 'ruby-1.9.3' + } + ] end default['jenkins_cookbook_ci']['wrapper_support'] = false
Add config for jenkins for rvm
diff --git a/vendor/plugins/vacancies/app/models/vacancy.rb b/vendor/plugins/vacancies/app/models/vacancy.rb index abc1234..def5678 100644 --- a/vendor/plugins/vacancies/app/models/vacancy.rb +++ b/vendor/plugins/vacancies/app/models/vacancy.rb @@ -2,10 +2,6 @@ acts_as_indexed :fields => [:job_title, :reference, :starting_salary, :past_probation, :closing_date, :description] - validates_presence_of :job_title - validates_uniqueness_of :job_title - belongs_to :file_download, :class_name => 'Resource' - end
Remove the mandatory field files for jobs
diff --git a/proto.rb b/proto.rb index abc1234..def5678 100644 --- a/proto.rb +++ b/proto.rb @@ -15,23 +15,18 @@ puts "Called with #{original_path}" class WorkQueue - def initialize(count = 4) + def initialize(count = 4, &block) @threads = [] @pool = Thread.pool(count) + @block = block end - def <<(file_path) + def <<(*args) @threads << Thread.new do @pool.process do - call(file_path) + @block.call(*args) end end - end - - def call(file_path) - puts "START #{file_path}" - sleep(rand) - puts "STOP #{file_path}" end def join @@ -40,8 +35,12 @@ end end -puts "" -identify_file_queue = WorkQueue.new +identify_file_queue = WorkQueue.new do |i| + puts "START #{i}" + sleep(rand) + puts "STOP #{i}" +end + 100.times do |i| identify_file_queue << i end
Use block to define work to be done
diff --git a/test/lib/test_core_extensions.rb b/test/lib/test_core_extensions.rb index abc1234..def5678 100644 --- a/test/lib/test_core_extensions.rb +++ b/test/lib/test_core_extensions.rb @@ -0,0 +1,29 @@+require 'test_helper' + +class TestCoreExtensions < Test::Unit::TestCase + + test "to_b" do + assert_equal "true".to_b, true + assert_equal "TRUE".to_b, true + assert_equal "false".to_b, false + assert_equal "FALSE".to_b, false + assert_equal " true ".to_b, true + assert_equal " false ".to_b, false + end + + # Taken from ActiveSupport: /activesupport/test/core_ext/blank_test.rb + + BLANK = [ nil, false, '', ' ', " \n\t \r ", [], {} ] + NOT = [ Object.new, true, 0, 1, 'a', [nil], { nil => 0 } ] + + test "blank?" do + BLANK.each { |v| assert v.blank?, "#{v.inspect} should be blank" } + NOT.each { |v| assert !v.blank?, "#{v.inspect} should not be blank" } + end + + test "present?" do + BLANK.each { |v| assert !v.present?, "#{v.inspect} should not be present" } + NOT.each { |v| assert v.present?, "#{v.inspect} should be present" } + end + +end
Include tests from active support gem for the blank? and present? functionality and add our own test for our custom to_b string method.
diff --git a/cookbooks/nelhage/recipes/users.rb b/cookbooks/nelhage/recipes/users.rb index abc1234..def5678 100644 --- a/cookbooks/nelhage/recipes/users.rb +++ b/cookbooks/nelhage/recipes/users.rb @@ -3,6 +3,14 @@ uid 2000 shell '/bin/bash' supports :manage_home => true +end + +%w[sudoers www-data].each do |grp| + group grp do + action :modify + members "nelhage" + append true + end end directory '/home/nelhage/.ssh' do
Add me to some groups.
diff --git a/railties/lib/rails/engine/commands.rb b/railties/lib/rails/engine/commands.rb index abc1234..def5678 100644 --- a/railties/lib/rails/engine/commands.rb +++ b/railties/lib/rails/engine/commands.rb @@ -9,14 +9,13 @@ command = ARGV.shift command = aliases[command] || command +require ENGINE_PATH +engine = ::Rails::Engine.find(ENGINE_ROOT) + case command when 'generate' require 'rails/generators' - - require ENGINE_PATH - engine = ::Rails::Engine.find(ENGINE_ROOT) engine.load_generators - require 'rails/commands/generate' when '--version', '-v'
Move requiring engine out of the switch case
diff --git a/app/controllers/debit_invoices_controller.rb b/app/controllers/debit_invoices_controller.rb index abc1234..def5678 100644 --- a/app/controllers/debit_invoices_controller.rb +++ b/app/controllers/debit_invoices_controller.rb @@ -1,11 +1,4 @@ class DebitInvoicesController < AuthorizedController - # Actions - def show - @attachments = resource.attachments - - show! - end - def new # Allow pre-seeding some parameters invoice_params = {
Drop custom show action for debit invoices.
diff --git a/app/controllers/task_templates_controller.rb b/app/controllers/task_templates_controller.rb index abc1234..def5678 100644 --- a/app/controllers/task_templates_controller.rb +++ b/app/controllers/task_templates_controller.rb @@ -1,34 +1,5 @@ # encoding: UTF-8 class TaskTemplatesController < TasksController -#this actions defined in TasksController but unused in TasksTemplatesController -#they never called, but if some code call one of them, we need to know -#TODO: all this actions must be changed in production - CUSTOM_ERROR_MESSAGE="tasks_tempaltes don't have this action, only tasks have " - def auto_complete_for_resource_name - raise Exception, CUSTOM_ERROR_MESSAGE - end - def resource - raise Exception, CUSTOM_ERROR_MESSAGE - end - def dependency - raise Exception, CUSTOM_ERROR_MESSAGE - end - def ajax_restore - raise Exception, CUSTOM_ERROR_MESSAGE - end - def ajax_hide - raise Exception, CUSTOM_ERROR_MESSAGE - end - def updatelog - raise Exception, CUSTOM_ERROR_MESSAGE - end - def update_sheet_info - raise Exception, CUSTOM_ERROR_MESSAGE - end - def update_work_log - raise Exception, CUSTOM_ERROR_MESSAGE - end - def destroy @task_template = current_templates.detect { |template| template.id == params[:id].to_i } @task_template.destroy
Remove dumb actions from TasksTemplatesController. No one call them, so we do not need them.
diff --git a/app/presenters/renalware/hd/mdm_presenter.rb b/app/presenters/renalware/hd/mdm_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/renalware/hd/mdm_presenter.rb +++ b/app/presenters/renalware/hd/mdm_presenter.rb @@ -16,7 +16,8 @@ @sessions ||= begin sessions = Sessions::LatestPatientSessionsQuery .new(patient: patient) - .call(max_sessions: 6).includes(:patient, :hospital_unit) + .call(max_sessions: 6) + .includes(:patient, :hospital_unit, :signed_on_by, :signed_off_by) CollectionPresenter.new(sessions, SessionPresenter, view_context) end end
Include :signed_on_by, :signed_off_by in HD MDM session query
diff --git a/telemetry-logger.gemspec b/telemetry-logger.gemspec index abc1234..def5678 100644 --- a/telemetry-logger.gemspec +++ b/telemetry-logger.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'telemetry-logger' - s.version = '0.1.7' + s.version = '0.1.8' s.summary = 'Logging to STDERR with coloring and levels of severity' s.description = ' '
Package version patch number is increased from 0.1.7 to 0.1.8
diff --git a/templates/environment.rb b/templates/environment.rb index abc1234..def5678 100644 --- a/templates/environment.rb +++ b/templates/environment.rb @@ -1,42 +1,9 @@-# Be sure to restart your server when you modify this file - -# Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION -# Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') Rails::Initializer.run do |config| - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Add additional load paths for your own custom dirs - # config.load_paths += %W( #{RAILS_ROOT}/extras ) - - # Specify gems that this application depends on and have them installed with rake gems:install - # config.gem "bj" - # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" - # config.gem "sqlite3-ruby", :lib => "sqlite3" - # config.gem "aws-s3", :lib => "aws/s3" config.gem "basic_assumption" - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Skip frameworks you're not going to use. To use Rails without a database, - # you must remove the Active Record framework. - # config.frameworks -= [ :active_record, :active_resource, :action_mailer ] - - # Activate observers that should always be running - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. config.time_zone = 'UTC' - - # 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}')] - # config.i18n.default_locale = :de end
Remove comments from template file
diff --git a/test/models/role_test.rb b/test/models/role_test.rb index abc1234..def5678 100644 --- a/test/models/role_test.rb +++ b/test/models/role_test.rb @@ -9,17 +9,17 @@ test 'should return all roles list if super_administrator' do roles = Role.allowed_roles_for_user_role(@super_administrator) assert_equal roles.count, 3 - assert roles.exists?(name: 'subscriber') - assert roles.exists?(name: 'administrator') - assert roles.exists?(name: 'super_administrator') + assert roles.any? { |role| role.include?('Administrateur') } + assert roles.any? { |role| role.include?('Abonné') } + assert roles.any? { |role| role.include?('Super administrateur') } end test 'should return all roles list except super_administrator if administrator' do roles = Role.allowed_roles_for_user_role(@administrator) assert_equal roles.count, 2 - assert roles.exists?(name: 'administrator') - assert roles.exists?(name: 'subscriber') - assert_not roles.exists?(name: 'super_administrator') + assert roles.any? { |role| role.include?('Administrateur') } + assert roles.any? { |role| role.include?('Abonné') } + assert_not roles.any? { |role| role.include?('Super administrateur') } end test 'should return nil if subscriber' do
Fix broken role test after refactoring collection
diff --git a/test/models/user_test.rb b/test/models/user_test.rb index abc1234..def5678 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -18,18 +18,12 @@ end test "User without name should not be valid" do - @user = User.new name: '', - email: 'testing@example.com', - password: '123456', - password_confirmation: '123456' + @user.name = '' assert_not @user.valid? end test "User without email should not be valid" do - @user = User.new name: 'Testing Goldman', - email: '', - password: '123456', - password_confirmation: '123456' + @user.email = '' assert_not @user.valid? end
Refactor tests to reduce code size
diff --git a/test/repo_ignore_test.rb b/test/repo_ignore_test.rb index abc1234..def5678 100644 --- a/test/repo_ignore_test.rb +++ b/test/repo_ignore_test.rb @@ -14,14 +14,14 @@ end def test_path_ignored - assert_equal true, @repo.path_ignored?("ign") - assert_equal false, @repo.path_ignored?("ignore_not") - assert_equal true, @repo.path_ignored?("dir") - assert_equal true, @repo.path_ignored?("dir/foo") - assert_equal true, @repo.path_ignored?("dir/foo/bar") - assert_equal false, @repo.path_ignored?("foo/dir") - assert_equal true, @repo.path_ignored?("foo/dir/bar") - assert_equal false, @repo.path_ignored?("direction") + assert @repo.path_ignored?("ign") + refute @repo.path_ignored?("ignore_not") + assert @repo.path_ignored?("dir") + assert @repo.path_ignored?("dir/foo") + assert @repo.path_ignored?("dir/foo/bar") + refute @repo.path_ignored?("foo/dir") + assert @repo.path_ignored?("foo/dir/bar") + refute @repo.path_ignored?("direction") end end
Use assert ... instead of assert_equal true, ... and refute ... instead of assert_equal false, ...
diff --git a/lib/deferrer/configuration.rb b/lib/deferrer/configuration.rb index abc1234..def5678 100644 --- a/lib/deferrer/configuration.rb +++ b/lib/deferrer/configuration.rb @@ -1,11 +1,14 @@ module Deferrer module Configuration - attr_reader :redis + attr_accessor :redis attr_accessor :logger attr_accessor :inline - # Deferrer.redis_config = { :host => "localhost", :port => 6379 } + # Convenience for instantiating Redis. + # + # Example: + # Deferrer.redis_config = { :host => "localhost", :port => 6379 } def redis_config=(config) @redis = Redis.new(config) end
Allow the user to provide their own Redis. This allows the user to provide, for instance, a namespaced Redis.
diff --git a/spec/fabricators/grade_fabricator.rb b/spec/fabricators/grade_fabricator.rb index abc1234..def5678 100644 --- a/spec/fabricators/grade_fabricator.rb +++ b/spec/fabricators/grade_fabricator.rb @@ -1,6 +1,6 @@ Fabricator(:grade) do form :number - mark rand(1..10) + mark { rand(1..10) } comment Faker::HTMLIpsum.body user classroom { |attr| Fabricate(:classroom, :owner => attr[:user]) }
Update fabricator to follow fabrication syntax.
diff --git a/lib/tasks/activestorage.rake b/lib/tasks/activestorage.rake index abc1234..def5678 100644 --- a/lib/tasks/activestorage.rake +++ b/lib/tasks/activestorage.rake @@ -11,6 +11,7 @@ puts "Copied default configuration to config/storage_services.yml" migration_file_path = "db/migrate/#{Time.now.utc.strftime("%Y%m%d%H%M%S")}_active_storage_create_tables.rb" + FileUtils.mkdir_p Rails.root.join("db/migrate") FileUtils.cp File.expand_path("../../active_storage/migration.rb", __FILE__), Rails.root.join(migration_file_path) puts "Copied migration to #{migration_file_path}"
Create db/migrate if it doesn't exist
diff --git a/lib/tasks/redmine_audit.rake b/lib/tasks/redmine_audit.rake index abc1234..def5678 100644 --- a/lib/tasks/redmine_audit.rake +++ b/lib/tasks/redmine_audit.rake @@ -1,6 +1,27 @@+require 'redmine/version' +require 'redmine_audit/advisory' +require 'redmine_audit/database' + +desc <<-END_DESC +Check redmine vulnerabilities. + +Available options: + * users => comma separated list of user/group ids who should be notified + +Example: + rake redmine:bundle_audit users="1,23, 56" RAILS_ENV="production" +END_DESC namespace :redmine do - desc 'Check redmine vulnerabilities' task audit: :environment do + redmine_ver = Redmine::VERSION + advisories = RedmineAudit::Database.new.advisories(redmine_ver.to_s) + if advisories.length > 0 + options = {} + options[:users] = (ENV['users'] || '').split(',').each(&:strip!) + Mailer.with_synched_deliveries do + # TODO: send mail + end + end end end
Add rake task checking Redmine advisories.
diff --git a/lib/gscholar/utils/fetcher.rb b/lib/gscholar/utils/fetcher.rb index abc1234..def5678 100644 --- a/lib/gscholar/utils/fetcher.rb +++ b/lib/gscholar/utils/fetcher.rb @@ -10,11 +10,12 @@ @agent.pluggable_parser['text/plain'] = TextPlainParser # Without changing user-agent, google will not return utf-8 page @agent.user_agent_alias = 'Mac Safari' + hack + end - # hack to enable BibTeX download - scisig = @agent.get('http://scholar.google.com/scholar_settings'). - form_with(:action => "/scholar_setprefs").field_with(:name => 'scisig').value - @agent.get("http://scholar.google.com/scholar_setprefs?scisig=#{scisig}&num=20&scis=yes&scisf=4&instq=&save=") + def reset + @agent.reset + hack end def fetch(url) @@ -23,13 +24,21 @@ rescue Mechanize::ResponseCodeError => e case e.response_code when 403 - @agent.reset + reset retry else raise end end end + + private + # hack to enable BibTeX download + def hack + scisig = @agent.get('http://scholar.google.com/scholar_settings'). + form_with(:action => "/scholar_setprefs").field_with(:name => 'scisig').value + @agent.get("http://scholar.google.com/scholar_setprefs?scisig=#{scisig}&num=20&scis=yes&scisf=4&instq=&save=") + end end end
Apply 'BibTeX' hack after reset
diff --git a/lib/notifier/gcm/gcm_batch.rb b/lib/notifier/gcm/gcm_batch.rb index abc1234..def5678 100644 --- a/lib/notifier/gcm/gcm_batch.rb +++ b/lib/notifier/gcm/gcm_batch.rb @@ -3,15 +3,13 @@ module GCM class GCMBatch < Base - def initialize - @batch = {} - end - # todo should be made threadsafe protected def enqueue(notification, device_token) - @batch[notification] ||= [device_token] - tokens = @batch[notification] + @batch ||= {} + @batch[notification.message] = [] if @batch[notification].nil? + @batch[notification.message] << device_token + tokens = @batch[notification.message] if tokens.count >= Notifiable.gcm_batch_size send_batch(notification, tokens) end
Fix for active record notifications
diff --git a/lib/remitano/remi_accounts.rb b/lib/remitano/remi_accounts.rb index abc1234..def5678 100644 --- a/lib/remitano/remi_accounts.rb +++ b/lib/remitano/remi_accounts.rb @@ -1,3 +1,5 @@+require_relative "collection" + module Remitano class RemiAccounts < Remitano::Collection def me
Fix load error on heroku
diff --git a/lib/rip/utilities/location.rb b/lib/rip/utilities/location.rb index abc1234..def5678 100644 --- a/lib/rip/utilities/location.rb +++ b/lib/rip/utilities/location.rb @@ -1,9 +1,9 @@ module Rip::Utilities class Location attr_reader :origin - attr_reader :offset - attr_reader :line - attr_reader :column + attr_reader :offset # zero-based offset from begining of file + attr_reader :line # one-based line + attr_reader :column # one-based character on line def initialize(origin, offset, line, column) @origin = origin
Add some comments to Rip::Utilities::Location
diff --git a/lib/sensu-plugin/check/cli.rb b/lib/sensu-plugin/check/cli.rb index abc1234..def5678 100644 --- a/lib/sensu-plugin/check/cli.rb +++ b/lib/sensu-plugin/check/cli.rb @@ -15,8 +15,12 @@ end end - def format_output(status, output) - "#{self.class.check_name}: #{status} - #{output}" + def message(msg) + @message = msg + end + + def format_output(status, msg=@message) + "#{self.class.check_name}: #{status}" + (msg ? " - #{msg}" : "") end end
Allow setting message with method and then exiting without args
diff --git a/lib/simplecov_compact_json.rb b/lib/simplecov_compact_json.rb index abc1234..def5678 100644 --- a/lib/simplecov_compact_json.rb +++ b/lib/simplecov_compact_json.rb @@ -16,20 +16,20 @@ def format(result) @result = result File.open("./coverage/results.json", "w") do |file| - file.print(parsed_result) + file.print(formatted_result) end end - def parsed_result + def formatted_result { - summary: parsed_summary, - files: parsed_files + summary: summary_results, + files: file_results }.to_json end private - def parsed_files + def file_results self.result.files.map do |file| { filename: file.filename, @@ -38,7 +38,7 @@ end end - def parsed_summary + def summary_results { coverage: result.covered_percent.round(2), }
Rename some methods for clarity.
diff --git a/lib/friendly_id/sequel_adapter/simple_model.rb b/lib/friendly_id/sequel_adapter/simple_model.rb index abc1234..def5678 100644 --- a/lib/friendly_id/sequel_adapter/simple_model.rb +++ b/lib/friendly_id/sequel_adapter/simple_model.rb @@ -9,7 +9,7 @@ include FriendlyId::Finders::Single def find - with_sql(query).first if friendly? + with_sql(query).first if !unfriendly? end private
Fix searches by numeric string.
diff --git a/lib/puppet/provider/vagrant_box/vagrant_box.rb b/lib/puppet/provider/vagrant_box/vagrant_box.rb index abc1234..def5678 100644 --- a/lib/puppet/provider/vagrant_box/vagrant_box.rb +++ b/lib/puppet/provider/vagrant_box/vagrant_box.rb @@ -32,8 +32,8 @@ else name, vprovider = @resource[:name].split('/') - File.directory? \ - "/Users/#{Facter[:boxen_user].value}/.vagrant.d/boxes/#{name}/#{vprovider}" + boxes = vagrant "box", "list" + boxes =~ /^#{name}\s+\(#{vprovider}\)/ end end
Replace filesystem test with vagrant box list Vagrant 1.5 added box version support, which changes the directory structure that we were expecting. As slow as it is, we should use vagrant's `box list` command to test which boxes are installed, rather than depending on knowledge of its private directory structure.
diff --git a/db/migrate/20131108092159_cleanup_invalid_paths_prefixes.rb b/db/migrate/20131108092159_cleanup_invalid_paths_prefixes.rb index abc1234..def5678 100644 --- a/db/migrate/20131108092159_cleanup_invalid_paths_prefixes.rb +++ b/db/migrate/20131108092159_cleanup_invalid_paths_prefixes.rb @@ -1,6 +1,8 @@ class CleanupInvalidPathsPrefixes < Mongoid::Migration def self.up Artefact.skip_callback(:update, :after, :update_editions) + Artefact.observers.disable(:update_router_observer) + Artefact.observers.disable(:update_search_observer) Artefact.all.each do |a| all_paths = (a.prefixes || []) + (a.paths || []) if all_paths.any? {|p| ! a.send(:valid_url_path?, p) }
Disable observers when cleaning data. We don't want to trigger these. Also they were leading to timeouts on preview...
diff --git a/cookbooks/universe_ubuntu/test/recipes/default_test.rb b/cookbooks/universe_ubuntu/test/recipes/default_test.rb index abc1234..def5678 100644 --- a/cookbooks/universe_ubuntu/test/recipes/default_test.rb +++ b/cookbooks/universe_ubuntu/test/recipes/default_test.rb @@ -5,14 +5,26 @@ # The Inspec reference, with examples and extensive documentation, can be # found at https://docs.chef.io/inspec_reference.html -unless os.windows? - describe user('root') do - it { should exist } - skip 'This is an example test, replace with your own test.' +packages = %w(golang + libjpeg-turbo8-dev + make + tmux + htop + chromium-browser + git + cmake + zlib1g-dev + libjpeg-dev + xvfb + libav-tools + xorg-dev + python-opengl + libboost-all-dev + libsdl2-dev + swig) + +packages.each do |item| + describe package item do + it { should be_installed } end end - -describe port(80) do - it { should_not be_listening } - skip 'This is an example test, replace with your own test.' -end
Add test on installed packages
diff --git a/spec/capybara/remote/viewer/server_spec.rb b/spec/capybara/remote/viewer/server_spec.rb index abc1234..def5678 100644 --- a/spec/capybara/remote/viewer/server_spec.rb +++ b/spec/capybara/remote/viewer/server_spec.rb @@ -19,7 +19,7 @@ it 'links to existing files' do get '/' - last_response.body.should =~ %r{<a href='/files/1'>1</a>} + last_response.body.should =~ %r{<a href='/files/1' target='porthole'>1</a>} end end
Fix up server HTML spec
diff --git a/app/controllers/api/cloud_volumes_controller.rb b/app/controllers/api/cloud_volumes_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/cloud_volumes_controller.rb +++ b/app/controllers/api/cloud_volumes_controller.rb @@ -1,4 +1,11 @@ module Api class CloudVolumesController < BaseController + def delete_resource(type, id, _data) + cloud_volume = resource_search(id, type, collection_class(:cloud_volumes)) + task_id = cloud_volume.delete_volume_queue(User.current_user) + action_result(true, "Deleting Cloud Volume #{cloud_volume.name}", :task_id => task_id) + rescue => err + action_result(false, err.to_s) + end end end
Add delete_resource method that does queued delete of cloud volumes
diff --git a/lib/payments/client/gateway.rb b/lib/payments/client/gateway.rb index abc1234..def5678 100644 --- a/lib/payments/client/gateway.rb +++ b/lib/payments/client/gateway.rb @@ -19,8 +19,8 @@ connection.public_send(verb, prefix(path), params) do |request| request.headers["X-Request-Id"] = Payments::Client.request_id end - rescue Faraday::Error - raise Payments::Client::Error + rescue Faraday::Error => e + raise Payments::Client::Error.new(e.message) end end end
Add Faraday error message to custom error
diff --git a/lib/rom/sql/type_extensions.rb b/lib/rom/sql/type_extensions.rb index abc1234..def5678 100644 --- a/lib/rom/sql/type_extensions.rb +++ b/lib/rom/sql/type_extensions.rb @@ -14,7 +14,7 @@ # @api public def [](type) unwrapped = type.optional? ? type.right : type - @types[unwrapped.pristine] || EMPTY_HASH + @types[unwrapped.meta(sql_expr: nil)] || EMPTY_HASH end # Registers a set of operations supported for a specific type @@ -34,7 +34,7 @@ mod = Module.new(&block) ctx = Object.new.extend(mod) functions = mod.public_instance_methods.each_with_object({}) { |m, ms| ms[m] = ctx.method(m) } - @types[type] = functions + @types[type.meta(sql_expr: nil)] = functions end end
Reset sql_expr in type extensions
diff --git a/lib/tasks/redmine_jenkins.rake b/lib/tasks/redmine_jenkins.rake index abc1234..def5678 100644 --- a/lib/tasks/redmine_jenkins.rake +++ b/lib/tasks/redmine_jenkins.rake @@ -0,0 +1,27 @@+# require 'rspec' +# require 'rspec/core/rake_task' + +namespace :redmine_jenkins do + + desc "Show library version" + task :version do + puts "Redmine Jenkins #{version("plugins/redmine_jenkins/init.rb")}" + end + + + desc "Start unit tests" + task :test => :default + task :default => [:environment] do + RSpec::Core::RakeTask.new(:spec) do |config| + config.rspec_opts = "plugins/redmine_jenkins/spec --color" + end + Rake::Task["spec"].invoke + end + + + def version(path) + line = File.read(Rails.root.join(path))[/^\s*version\s*.*/] + line.match(/.*version\s*['"](.*)['"]/)[1] + end + +end
Add Rake task to start tests
diff --git a/Casks/abricotine.rb b/Casks/abricotine.rb index abc1234..def5678 100644 --- a/Casks/abricotine.rb +++ b/Casks/abricotine.rb @@ -0,0 +1,14 @@+cask 'abricotine' do + version '0.2.2' + sha256 '2a540ff77f1076660805ca3fde507f0095ae6a1ce83aade3e9f07613259a21f7' + + # github.com/brrd/Abricotine was verified as official when first introduced to the cask + url "https://github.com/brrd/Abricotine/releases/download/#{version}/Abricotine-osx-x64.zip" + appcast 'https://github.com/brrd/Abricotine/releases.atom', + checkpoint: 'eaea002610ceedecd5920957c123575cc168e8292bd34caadb9f44c2ec4e8fa8' + name 'abricotine' + homepage 'http://abricotine.brrd.fr' + license :gpl + + app 'Abricotine.app' +end
Add Abricotine - a markdown editor for desktop In **Abricotine**, you can preview your document directly in the text editor rather than in a side pane. ![Another screenshot](http://i.imgur.com/ZDHgo9i.jpg) * Write in markdown (or GFM) and export your documents in HTML, * Preview text elements (such as headers, images, math, embedded videos, todo lists...) while you type, * Display document table of content in the side pane, * Display syntax highlighting for supported languages (HTML, XML, CSS, Javascript, and more to come...), * Show helpers, anchors and hidden characters, * Copy formated HTML in the clipboard, * Write in a distraction-free fullscreen view, * Manage and beautify markdown tables, * Search and replace text, * And more features to come...
diff --git a/Casks/fluxus.rb b/Casks/fluxus.rb index abc1234..def5678 100644 --- a/Casks/fluxus.rb +++ b/Casks/fluxus.rb @@ -2,6 +2,7 @@ version '0.17-3.rc4' sha256 'ee4608af10117e87a905004f2a4e3a77c1c587bb6d6d8d533e7285c2ce4d9d96' + # mndl.hu/fluxus was verified as official when first introduced to the cask url "http://mndl.hu/fluxus/fluxus-#{version}.mac_intel.10.5.dmg.zip" name 'Fluxus' homepage 'http://www.pawfal.org/fluxus/'
Fix `url` stanza comment for Fluxus.
diff --git a/Formula/automoc4.rb b/Formula/automoc4.rb index abc1234..def5678 100644 --- a/Formula/automoc4.rb +++ b/Formula/automoc4.rb @@ -1,11 +1,12 @@ require 'formula' class Automoc4 <Formula - @url='http://ftp-stud.fht-esslingen.de/Mirrors/ftp.kde.org/pub/kde/stable/automoc4/0.9.88/automoc4-0.9.88.tar.bz2' + @url='ftp://ftp.kde.org/pub/kde/stable/automoc4/0.9.88/automoc4-0.9.88.tar.bz2' @homepage='http://techbase.kde.org/Development/Tools/Automoc4' @md5='91bf517cb940109180ecd07bc90c69ec' depends_on 'cmake' + depends_on 'qt' def install system "cmake . #{std_cmake_parameters}"
Use KDE FTP and add needed Qt dependency for Automoc4.
diff --git a/modules/ssh/lib/puppet/parser/functions/extract_public_key.rb b/modules/ssh/lib/puppet/parser/functions/extract_public_key.rb index abc1234..def5678 100644 --- a/modules/ssh/lib/puppet/parser/functions/extract_public_key.rb +++ b/modules/ssh/lib/puppet/parser/functions/extract_public_key.rb @@ -1,7 +1,11 @@ module Puppet::Parser::Functions newfunction(:extract_public_key, :type => :rvalue) do |args| key = args[0] - match_data = /^([^\s]+)\s+([^\s]+)\s+([^\s]+)/.match(key) - {'type' => match_data[1], 'sha' => match_data[2], 'comment' => match_data[3]} + match_data = /^(?:(ssh-[^\s]+)\s+)?([^\s]+)(?:\s+([^\s]+))?/.match(key) + { + 'type' => match_data[1] || 'ssh-rsa', + 'sha' => match_data[2], + 'comment' => match_data[3] || '', + } end end
Allow empty type and comment
diff --git a/lib/generators/ruby_rabbitmq_janus/initializer_generator.rb b/lib/generators/ruby_rabbitmq_janus/initializer_generator.rb index abc1234..def5678 100644 --- a/lib/generators/ruby_rabbitmq_janus/initializer_generator.rb +++ b/lib/generators/ruby_rabbitmq_janus/initializer_generator.rb @@ -11,7 +11,7 @@ initializer 'ruby_rabbitmq_janus.rb' do "# frozen_string_literal: true\n\n" \ "::RRJ = RubyRabbitmqJanus::RRJ.new\n"\ - '::Events = RubyRabbitmqJanus::Janus::Concurrencies::Event.instance' + '::JanusEvents = RubyRabbitmqJanus::Janus::Concurrencies::Event.instance' end end end
Change name listen events janus
diff --git a/lib/yard/server/templates/default/layout/html/setup.rb b/lib/yard/server/templates/default/layout/html/setup.rb index abc1234..def5678 100644 --- a/lib/yard/server/templates/default/layout/html/setup.rb +++ b/lib/yard/server/templates/default/layout/html/setup.rb @@ -1,5 +1,5 @@ def javascripts - super + %w(js/autocomplete.js js/live.js) + super + %w(js/autocomplete.js) end def stylesheets
Remove reference to live.js in template Fixes #603
diff --git a/lib/rspec/active_record.rb b/lib/rspec/active_record.rb index abc1234..def5678 100644 --- a/lib/rspec/active_record.rb +++ b/lib/rspec/active_record.rb @@ -9,11 +9,16 @@ include ::ActiveRecord::TestFixtures included do - self.fixture_path = RSpec.configuration.fixture_path - self.use_transactional_fixtures = RSpec.configuration.use_transactional_fixtures - self.use_instantiated_fixtures = RSpec.configuration.use_instantiated_fixtures - self.pre_loaded_fixtures = RSpec.configuration.pre_loaded_fixtures - fixtures RSpec.configuration.global_fixtures if RSpec.configuration.global_fixtures + %w{fixture_path use_transactional_fixtures + use_instantiated_fixtures pre_loaded_fixtures}.each do |param| + self.send("#{param}=".to_sym, RSpec.configuration.send(param.to_sym)) + end + + %w{fixture_table_names fixture_class_names global_fixtures}.each do |param| + if RSpec.configuration.send(param.to_sym) + self.send("#{param}=".to_sym, RSpec.configuration.send(param.to_sym)) + end + end end end @@ -25,6 +30,8 @@ c.add_setting :pre_loaded_fixtures c.add_setting :global_fixtures c.add_setting :fixture_path + c.add_setting :fixture_table_names + c.add_setting :fixture_class_names end end end
Add fixture_table_names and fixture_class_names config settings
diff --git a/app/models/team_membership.rb b/app/models/team_membership.rb index abc1234..def5678 100644 --- a/app/models/team_membership.rb +++ b/app/models/team_membership.rb @@ -11,7 +11,7 @@ scope :with_interests, -> { where('exists(select 1 from team_membership_interests tmi where tmi.team_membership_id = team_memberships.id)') } after_commit :update_counter_caches - after_commit :assign_vector_from_text + # after_commit :assign_vector_from_text # FIXME: Calling this method crashes Meta def core_team? self.is_core
Fix issue where analyzing text makes intros fail
diff --git a/geoip-extensions.gemspec b/geoip-extensions.gemspec index abc1234..def5678 100644 --- a/geoip-extensions.gemspec +++ b/geoip-extensions.gemspec @@ -22,8 +22,8 @@ s.add_dependency("geoip-c") s.add_dependency("ffi-geos") - s.add_dependency("rdoc") - s.add_dependency("rake", ["~> 0.9"]) - s.add_dependency("minitest") - s.add_dependency("turn") + s.add_development_dependency("rdoc") + s.add_development_dependency("rake", ["~> 0.9"]) + s.add_development_dependency("minitest") + s.add_development_dependency("turn") end
Make these gems into development dependencies.
diff --git a/lib/puppet/parser/functions/openldap_password.rb b/lib/puppet/parser/functions/openldap_password.rb index abc1234..def5678 100644 --- a/lib/puppet/parser/functions/openldap_password.rb +++ b/lib/puppet/parser/functions/openldap_password.rb @@ -1,14 +1,16 @@ module Puppet::Parser::Functions - newfunction(:openldap_password, :type => :rvalue, :doc => <<-EOS + newfunction( + :openldap_password, + :type => :rvalue, + :arity => -2, + :doc => <<-EOS Returns the openldap password hash from the clear text password. EOS ) do |args| - raise(Puppet::ParseError, "openldap_password(): Wrong number of arguments given") if args.size < 1 or args.size > 2 - - secret = args[0] + secret = args[0] command = ['slappasswd', '-s', secret] - scheme = args[1] if args[1] + scheme = args[1] if args[1] command << ['-h', scheme] if scheme Puppet::Util::Execution.execute(command.flatten).strip
Use arity feature of newfunction instead of manual argument check
diff --git a/lib/yard/server/commands/display_file_command.rb b/lib/yard/server/commands/display_file_command.rb index abc1234..def5678 100644 --- a/lib/yard/server/commands/display_file_command.rb +++ b/lib/yard/server/commands/display_file_command.rb @@ -11,7 +11,7 @@ def run filename = File.cleanpath(File.join(library.source_path, path)) raise NotFoundError unless File.file?(filename) - if filename =~ /\.(jpe?g|gif|png|bmp)$/i + if filename =~ /\.(jpe?g|gif|png|bmp|svg)$/i headers['Content-Type'] = StaticFileCommand::DefaultMimeTypes[$1.downcase] || 'text/html' render File.read_binary(filename) else
Add "svg" as a extension of image filenames SVG images are recognized by modern browsers and shouldn't be displayed as text but as image. SVG is also a very useful format for documentation purposes.
diff --git a/spec/support/test/resource_service.rb b/spec/support/test/resource_service.rb index abc1234..def5678 100644 --- a/spec/support/test/resource_service.rb +++ b/spec/support/test/resource_service.rb @@ -0,0 +1,14 @@+require ::File.expand_path('../resource.pb', __FILE__) + +module Test + class ResourceService + + # request -> Test::ResourceFindRequest + # response -> Test::Resource + def find + response.name = request.name + response.status = request.active ? 1 : 0 + end + + end +end
Add back in ResourceService implementation for spec
diff --git a/test/basepack_test_app/app/components/book_grid_with_persistence.rb b/test/basepack_test_app/app/components/book_grid_with_persistence.rb index abc1234..def5678 100644 --- a/test/basepack_test_app/app/components/book_grid_with_persistence.rb +++ b/test/basepack_test_app/app/components/book_grid_with_persistence.rb @@ -1,8 +1,8 @@ class BookGridWithPersistence < BookGrid - override_column :author__name, :included => false - def default_config - super.merge :persistence => true + def configure + super + config.persistence = true end end
Update config syntax in BookGridWithPersistence
diff --git a/app/controllers/api/drops_controller.rb b/app/controllers/api/drops_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/drops_controller.rb +++ b/app/controllers/api/drops_controller.rb @@ -1,3 +1,5 @@+# We use .map instead of .pluck, as .pluck modifies the SELECT clause and produces strange results. + class Api::DropsController < ApplicationController respond_to :json
Add comment to explain why we use .map
diff --git a/core/app/interactors/backend/sub_comments.rb b/core/app/interactors/backend/sub_comments.rb index abc1234..def5678 100644 --- a/core/app/interactors/backend/sub_comments.rb +++ b/core/app/interactors/backend/sub_comments.rb @@ -13,7 +13,7 @@ end def self.destroy!(id:) - SubComment.find(id).delete #TODO:otherdelete? + SubComment.find(id).destroy end def self.create!(parent_id:, content:, user:)
Use destroy instead of delete for subcomments
diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index abc1234..def5678 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -13,11 +13,11 @@ end def show - send_file @document.document.path, type: @document.document_content_type, disposition: 'inline' + send_file Paperclip.io_adapters.for(@document.document).path, type: @document.document_content_type, disposition: 'inline' end def download - send_file @document.document.path, type: @document.document_content_type, x_sendfile: true + send_file Paperclip.io_adapters.for(@document.document).path, type: @document.document_content_type, x_sendfile: true end def update
Send file using a Paperclip.io_adapter Reading a path to the file only works for documents stored locally. This way, the document is fetched to a tempfile. This can be sent directly and should work with containerised solutions such as docker and heroku provided they have tempfile storage available.
diff --git a/spec/mailcatcher/api/mailbox_spec.rb b/spec/mailcatcher/api/mailbox_spec.rb index abc1234..def5678 100644 --- a/spec/mailcatcher/api/mailbox_spec.rb +++ b/spec/mailcatcher/api/mailbox_spec.rb @@ -14,6 +14,7 @@ describe '#messages' do it 'without reload' do + expect(mailbox.messages.count).to be @mailbox_size mailbox.messages.each do |msg| expect(msg).to be_an_instance_of(MailCatcher::API::Mailbox::Message) end @@ -24,7 +25,13 @@ end it 'with reload' do - skip + old_mailbox_size = @mailbox_size + expect(mailbox.messages.count).to be old_mailbox_size + unstub_mailbox + new_mailbox_size = old_mailbox_size + 1 + stub_mailbox(new_mailbox_size) + expect(mailbox.messages.count).to be old_mailbox_size + expect(mailbox.messages(reload: true).count).to be new_mailbox_size end end
Add spec for Mailbox.messages(reload: true)
diff --git a/app/controllers/answer_controller.rb b/app/controllers/answer_controller.rb index abc1234..def5678 100644 --- a/app/controllers/answer_controller.rb +++ b/app/controllers/answer_controller.rb @@ -16,9 +16,9 @@ # reference: https://stackoverflow.com/questions/35639507/parametrized-join-in-rails-4 def index if params.key?(:response_id) - join_query = sanitize_sql_array(["LEFT JOIN answers ON answers.question_id = questions.id AND answers.response_id = '?'", params[:response_id]) + join_query = sanitize_sql_array(["LEFT JOIN answers ON answers.question_id = questions.id AND answers.response_id = '?'", params[:response_id]]) end - where_query = sanitize_sql_array(["questions.questionnaire_id = '?'", params[:questionnaire_id]) if params.key?(:questionnaire_id) + where_query = sanitize_sql_array(["questions.questionnaire_id = '?'", params[:questionnaire_id]]) if params.key?(:questionnaire_id) # get all answers given the questionaire and response id question_answers = Question.joins(join_query) .select('answers.*, questions.txt as qtxt, questions.type as qtype, questions.seq as qseq')
Fix an issue related to square brackets
diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index abc1234..def5678 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -1,6 +1,10 @@ class GroupsController < ApplicationController def show - @group = current_group || Group.find(params[:id]) + if params[:id] + @group = Group.find(params[:id]) + else current_group + @group = current_group + end @recent_threads = @group.threads.order("created_at DESC").limit(10) @recent_issues = @group.recent_issues.limit(10) end
Fix group context overriding group page display.
diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index abc1234..def5678 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -42,9 +42,10 @@ end def destroy + group = @topic.group @topic.destroy respond_to do |format| - format.html { redirect_to topics_url } + format.html { redirect_to group_path(group) } format.json { head :no_content } end end
Make redirect go to group page
diff --git a/app/decorators/provider_decorator.rb b/app/decorators/provider_decorator.rb index abc1234..def5678 100644 --- a/app/decorators/provider_decorator.rb +++ b/app/decorators/provider_decorator.rb @@ -18,7 +18,7 @@ end def delete_link - if connected? + if oauthable? && connected? h.link_to "Disconnect", h.provider_destroy_path(self), method: :delete, "data-confirm": "Are you sure?" else "-"
Remove disconnect link from typeracer
diff --git a/app/services/projects/update_tags.rb b/app/services/projects/update_tags.rb index abc1234..def5678 100644 --- a/app/services/projects/update_tags.rb +++ b/app/services/projects/update_tags.rb @@ -8,11 +8,11 @@ def call(id_or_object) project = find_object(id_or_object) git = Git.open(project.local_path) - 3.tries on: Git::GitExecuteError, delay: 1 do + tags = 10.tries on: [Git::GitExecuteError, Git::GitTagNameDoesNotExist], delay: 1 do git.fetch 'origin', tags: true - end - tags = git.tags.each_with_object({}) do |tag, hash| - hash[tag.name] = git.gcommit(tag.sha).date + git.tags.each_with_object({}) do |tag, hash| + hash[tag.name] = git.gcommit(tag.sha).date + end end # Sort tags by date tags = Hash[*tags.sort_by(&:last).reverse.flatten]
Improve retry logic in projects update tags service
diff --git a/raygun_client.gemspec b/raygun_client.gemspec index abc1234..def5678 100644 --- a/raygun_client.gemspec +++ b/raygun_client.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'raygun_client' - s.version = '0.0.2.6' + s.version = '0.0.2.7' s.summary = 'Client for the Raygun API using the Obsidian HTTP client' s.description = ' '
Package version increased from 0.0.2.6 to 0.0.2.7
diff --git a/raygun_client.gemspec b/raygun_client.gemspec index abc1234..def5678 100644 --- a/raygun_client.gemspec +++ b/raygun_client.gemspec @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = 'raygun_client' - s.version = '0.4.0.0' + s.version = '0.5.0.0' s.summary = 'Client for the Raygun API using the Obsidian HTTP client' s.description = ' '
Package version increased from 0.4.0.0 to 0.5.0.0
diff --git a/homebrew/ruby-install.rb b/homebrew/ruby-install.rb index abc1234..def5678 100644 --- a/homebrew/ruby-install.rb +++ b/homebrew/ruby-install.rb @@ -4,6 +4,7 @@ homepage 'https://github.com/postmodern/ruby-install#readme' url 'https://github.com/postmodern/ruby-install/archive/v0.1.1.tar.gz' sha1 'f317934f830addcaf6544765a52df03c2d059254' + head 'https://github.com/postmodern/ruby-install.git' def install
Add a newline to appease the homebrew style gods.
diff --git a/app/screens/timers_screen.rb b/app/screens/timers_screen.rb index abc1234..def5678 100644 --- a/app/screens/timers_screen.rb +++ b/app/screens/timers_screen.rb @@ -9,7 +9,12 @@ def table_data [{ - :cells => Timer.all.map {|t| {:title => t.name} } + :cells => Timer.all.map do |timer| + { + :title => timer.name, + :subtitle => "#{(Time.now - timer.happenedAt).to_i} seconds ago" + } + end }] end
Set subtitle to elapsed time Closes #4
diff --git a/lib/docs/scrapers/rdoc/minitest.rb b/lib/docs/scrapers/rdoc/minitest.rb index abc1234..def5678 100644 --- a/lib/docs/scrapers/rdoc/minitest.rb +++ b/lib/docs/scrapers/rdoc/minitest.rb @@ -2,7 +2,7 @@ class Minitest < Rdoc self.name = 'Ruby / Minitest' self.slug = 'minitest' - self.release = '5.9.0' + self.release = '5.10.1' self.dir = '/Users/Thibaut/DevDocs/Docs/RDoc/Minitest' # rake docs self.links = { code: 'https://github.com/seattlerb/minitest'
Update Ruby / Minitest documentation (5.10.1)
diff --git a/lib/ifin24/commands/list_limits.rb b/lib/ifin24/commands/list_limits.rb index abc1234..def5678 100644 --- a/lib/ifin24/commands/list_limits.rb +++ b/lib/ifin24/commands/list_limits.rb @@ -1,10 +1,37 @@ # encoding: utf-8 class Ifin24::Commands::ListLimits < Ifin24::Commands::Base + BAR_SIZE = 50 def execute limits = @client.fetch_limits - print_list(limits, :name, :amount, :max) + limits.each do |limit| + widest_name_size = limits.map { |l| l.name }.inject(0) { |max, name| name.size >= max ? name.size : max } + name = limit.name.ljust(widest_name_size) + limit_bar = make_limit_bar(limit.amount, limit.max) + amount = "#{limit.amount}zł z #{limit.max}zł" + + puts "#{name} #{limit_bar} #{amount}" + end + end + + private + + def make_limit_bar(amount, max) + amount = [amount, max].min + taken = ((amount / max) * BAR_SIZE).to_i + + bar = "[" + taken.times do + bar << "#" + end + + (BAR_SIZE - taken).times do + bar << "." + end + bar << "]" + + return bar end end
Make nice bars for the expense limits.