diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/freshdesk/models/model.rb b/lib/freshdesk/models/model.rb index abc1234..def5678 100644 --- a/lib/freshdesk/models/model.rb +++ b/lib/freshdesk/models/model.rb @@ -28,7 +28,7 @@ def parse_resource(resource) model = self.new - resource ||= resource[@json_key] + resource = resource[@json_key] if resource[@json_key] @_fields.each do |f| model.send("#{f}=", resource[f.to_s]) if model.respond_to? "#{f}="
Fix users not working properly
diff --git a/test/integration/content_api_response_test.rb b/test/integration/content_api_response_test.rb index abc1234..def5678 100644 --- a/test/integration/content_api_response_test.rb +++ b/test/integration/content_api_response_test.rb @@ -0,0 +1,42 @@+require_relative "../integration_test_helper" + +class ContentApiResponseTest < ActionDispatch::IntegrationTest + def status_for_url(url, status) + url = "/#{url}" if url[0] != "/" + response = { + status: status, + body: "{\"test\":\"bleh\"}" + } + stub_request(:get, "https://contentapi.test.alphagov.co.uk#{url}.json").to_return(response) + end + + should "render the page with a 500 error code when receiving a 500 status" do + status_for_url "/my-item", 500 + visit "/my-item" + assert_equal 503, page.status_code + end + + should "render the page with a 500 error code when receiving a 501 status" do + status_for_url "/my-item", 501 + visit "/my-item" + assert_equal 503, page.status_code + end + + should "render the page with a 500 error code when receiving a 502 status" do + status_for_url "/my-item", 502 + visit "/my-item" + assert_equal 503, page.status_code + end + + should "render the page with a 500 error code when receiving a 503 status" do + status_for_url "/my-item", 503 + visit "/my-item" + assert_equal 503, page.status_code + end + + should "render the page with a 500 error code when receiving a 504 status" do + status_for_url "/my-item", 504 + visit "/my-item" + assert_equal 503, page.status_code + end +end
Add tests to check Content API status response These tests are stubbing all the possible response codes that the Content API might produce and making sure that we're responding consistently within the frontend app.
diff --git a/lib/haml/sass_rails_filter.rb b/lib/haml/sass_rails_filter.rb index abc1234..def5678 100644 --- a/lib/haml/sass_rails_filter.rb +++ b/lib/haml/sass_rails_filter.rb @@ -5,8 +5,9 @@ class SassRailsTemplate < ::Sass::Rails::SassTemplate if Gem::Version.new(Sprockets::VERSION) >= Gem::Version.new('3.0.0') def render(scope=Object.new, locals={}, &block) - scope = ::Rails.application.assets.context_class.new( - environment: ::Rails.application.assets, + environment = ::Sprockets::Railtie.build_environment(Rails.application) + scope = environment.context_class.new( + environment: environment, filename: "/", metadata: {} )
Fix for the case Rails.application.assets is nil cherry-picking @jvenezia's patch in https://github.com/haml/haml/pull/868#issuecomment-242689915.
diff --git a/lib/mobility/active_record.rb b/lib/mobility/active_record.rb index abc1234..def5678 100644 --- a/lib/mobility/active_record.rb +++ b/lib/mobility/active_record.rb @@ -7,13 +7,18 @@ module ActiveRecord require "mobility/active_record/uniqueness_validator" + class QueryMethod < Module + def initialize(query_method) + module_eval <<-EOM, __FILE__, __LINE__ + 1 + def #{query_method} + all + end + EOM + end + end + def self.included(model_class) - query_method = Module.new do - define_method Mobility.query_method do - all - end - end - model_class.extend query_method + model_class.extend QueryMethod.new(Mobility.query_method) unless model_class.const_defined?(:UniquenessValidator) model_class.const_set(:UniquenessValidator, Class.new(::Mobility::ActiveRecord::UniquenessValidator))
Use module_eval to define query scope, and name module
diff --git a/app/services/git_repository_service.rb b/app/services/git_repository_service.rb index abc1234..def5678 100644 --- a/app/services/git_repository_service.rb +++ b/app/services/git_repository_service.rb @@ -10,6 +10,6 @@ git_repo.update_authentication(:default => {:userid => git_username, :password => git_password}) end - return {:git_repo_id => git_repo.id, :new_git_repo? => new_git_repo} + {:git_repo_id => git_repo.id, :new_git_repo? => new_git_repo} end end
Fix rubocop warnings in GitRepositoryService
diff --git a/lib/dissociated_introspection/recording_parent.rb b/lib/dissociated_introspection/recording_parent.rb index abc1234..def5678 100644 --- a/lib/dissociated_introspection/recording_parent.rb +++ b/lib/dissociated_introspection/recording_parent.rb @@ -1,7 +1,5 @@ class RecordingParent < BasicObject - class << self - def method_missing(m, *args, &block) __missing_class_macros__.push({ m => [args, block].compact }) end
Remove some extra new lines.
diff --git a/lib/smartsheet/api/middleware/error_translator.rb b/lib/smartsheet/api/middleware/error_translator.rb index abc1234..def5678 100644 --- a/lib/smartsheet/api/middleware/error_translator.rb +++ b/lib/smartsheet/api/middleware/error_translator.rb @@ -0,0 +1,20 @@+require 'faraday' +require_relative '../error' + +module Smartsheet + module API + module Middleware + class ErrorTranslator < Faraday::Middleware + def initialize(app) + super(app) + end + + def call(env) + @app.call(env) + rescue Faraday::Error => e + raise Smartsheet::API::RequestError, e + end + end + end + end +end
Add middleware for capturing and wrapping errors.
diff --git a/lib/princely/asset_support.rb b/lib/princely/asset_support.rb index abc1234..def5678 100644 --- a/lib/princely/asset_support.rb +++ b/lib/princely/asset_support.rb @@ -16,6 +16,7 @@ def asset_file_path(asset) # Remove /assets/ from generated names and try and find a matching asset + Rails.application.assets ||= Sprockets::Environment.new Rails.application.assets.find_asset(asset.gsub(%r{/assets/}, "")).try(:pathname) || asset end end
Fix undefined method 'find_asset' for nil:NilClass error
diff --git a/lib/audit_tables.rb b/lib/audit_tables.rb index abc1234..def5678 100644 --- a/lib/audit_tables.rb +++ b/lib/audit_tables.rb @@ -1,24 +1,32 @@ # frozen_string_literal: true -require 'audit_tables/version' +require 'base' +require 'build_audit_trigger' +require 'change_audit_table' +require 'create_new_audit_table' +require 'create_audit_tables_for_existing_tables' module AuditTables - def create_audit_table_for(table_name) + def self.create_audit_table_for(table_name) AuditTables::CreateNewAuditTable.new(table_name.to_s).build end - def create_audit_tables_for_existing_tables(options = {}) + def self.create_audit_tables_for_existing_tables(options = {}) AuditTables::CreateAuditTablesForExistingTables.new(options[:excluded_tables]).process end - def change_audit_table_for(table_name) + def self.change_audit_table_for(table_name) AuditTables::ChangeAuditTable.new(table_name.to_s).execute end - def build_audit_triggers_for(table_name) + def self.build_audit_triggers_for(table_name) AuditTables::BuildAuditTrigger.new(table_name.to_s).build end - def rebuild_all_audit_triggers(options = {}) + def self.awesome? + puts 'awesome!!' + end + + def self.rebuild_all_audit_triggers(options = {}) tables = ActiveRecord::Base.connection.tables tables -= options[:excluded_tables]
Test against local copy of the gem and change methods
diff --git a/lib/clock_window.rb b/lib/clock_window.rb index abc1234..def5678 100644 --- a/lib/clock_window.rb +++ b/lib/clock_window.rb @@ -30,6 +30,31 @@ exe = "xprop -id $(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2) _NET_WM_NAME" format = ->str{ str.match(/.*\"(.*)\"\n\z/)[1][0..60] } [exe, format] + when /darwin/i + exe = <<-SCRIPT + osascript -e ' + global frontApp, frontAppName, windowTitle + + set windowTitle to "" + tell application "System Events" + set frontApp to first application process whose frontmost is true + set frontAppName to name of frontApp + tell process frontAppName + tell (1st window whose value of attribute "AXMain" is true) + set windowTitle to value of attribute "AXTitle" + end tell + end tell + end tell + + return {frontAppName, windowTitle} + ' + SCRIPT + + format = ->str { + app, window = str.split(',') + "#{window.strip} - #{app.strip}"[0..60] + } + [exe, format] else raise "Not implemented for #{@os}" end
Add Darwin (Mac) clause using external osascript
diff --git a/lib/jiraSOAP/url.rb b/lib/jiraSOAP/url.rb index abc1234..def5678 100644 --- a/lib/jiraSOAP/url.rb +++ b/lib/jiraSOAP/url.rb @@ -2,9 +2,10 @@ # MRI by using the URI module. # # For any JIRA entity that has a URL object as an instance variable, you can -# stick what ever type of object you want in the instance varible, as long as +# stick whatever type of object you want in the instance varible, as long as # the object has a #to_s method that returns a properly formatted URI. class URL + # @return [NSURL, URI::HTTP] the type depends on your RUBY_ENGINE attr_accessor :url @@ -15,7 +16,7 @@ @url = URI.parse url end - # The to_s method technically exists and so method_missing would not + # The #to_s method technically exists and so method_missing would not # work its magic to redirect it to @url so we manually override. # @return [String] def to_s
Tweak some documentation in the URL class
diff --git a/podTest.podspec b/podTest.podspec index abc1234..def5678 100644 --- a/podTest.podspec +++ b/podTest.podspec @@ -21,7 +21,7 @@ s.source = { :git => 'https://github.com/phoenixbox/podTest.git', :tag => s.version.to_s } s.source_files = "FeedbackLoop", "FeedbackLoop/**/*.{h,m}" s.exclude_files = "FeedbackLoop/Exclude" - s.dependency 'AFNetworking', '2.5.0' + s.dependency 'AFNetworking' s.requires_arc = true s.frameworks = ["Foundation", "UIKit"] s.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '$(inherited)' }
Update dependency version on AFNetworking
diff --git a/lib/voting_booth.rb b/lib/voting_booth.rb index abc1234..def5678 100644 --- a/lib/voting_booth.rb +++ b/lib/voting_booth.rb @@ -9,7 +9,7 @@ # to override this if, for instance, you are using devise with an Admin model # and namespace. Default: current_user mattr_accessor :find_voter_block - self.find_voter_block = lambda { current_user } + self.find_voter_block = Proc.new { current_user } # Specifies whether only allowing positive votes will be allowed. Useful if # you want to use this Engine as a favoriting/liking solution. Default:
Fix an issue where you couldn't vote under Ruby 1.9.2 and higher. Calling instance_eval yields self to any called lambdas, so voting failed every time we tried to look up current_user (see https://gist.github.com/479572). So instead, we use a Proc.
diff --git a/cookbooks/nagios/attributes/default.rb b/cookbooks/nagios/attributes/default.rb index abc1234..def5678 100644 --- a/cookbooks/nagios/attributes/default.rb +++ b/cookbooks/nagios/attributes/default.rb @@ -26,9 +26,13 @@ case node['platform_family'] when 'debian' -default['nagios']['plugin_dir'] = '/usr/lib/nagios/plugins' +default['nagios']['plugin_dir'] = '/usr/lib/nagios/plugins' when 'rhel','fedora' - default['nagios']['plugin_dir'] = '/usr/lib64/nagios/plugins' + if node['kernel']['machine'] == "i686" + default['nagios']['plugin_dir'] = '/usr/lib/nagios/plugins' + else + default['nagios']['plugin_dir'] = '/usr/lib64/nagios/plugins' + end else - default['nagios']['plugin_dir'] = '/usr/lib/nagios/plugins' + default['nagios']['plugin_dir'] = '/usr/lib/nagios/plugins' end
Add 32bit RHEL support for the nagios plugins directory Former-commit-id: 73bc64ab57e2e2986ee985041d88b2940822a87a [formerly 4c6d5109c5c343f56ea43ac5b1b69969023b6a46] [formerly 2eb2a13bc4b9ec104dbb8c7b739851482f642e8e [formerly e069b4bb04752849f3dc0c48a6223a0c925f313c [formerly 48457e6f5fd0593a8257cfff2b84db3d7642f6a4]]] Former-commit-id: d6ec4eefbd945dabe4dffa393a80d65ab7d921fa [formerly 5e0c0d02c26dd26661f2d1e3b801bb1c5948cfa0] Former-commit-id: 609fb277dff34efeabacfe73c96c58ecfb93a2ba Former-commit-id: c03c7bc391ded028ece7e863e55cb463e237d934
diff --git a/app/controllers/public_pages_controller.rb b/app/controllers/public_pages_controller.rb index abc1234..def5678 100644 --- a/app/controllers/public_pages_controller.rb +++ b/app/controllers/public_pages_controller.rb @@ -8,5 +8,6 @@ @profile_user = User.find_by(username: profile_username) not_found if @profile_user.nil? @profile = @profile_user.profile + not_found if @profile.nil? end end
Add 404 response for a user without a profile
diff --git a/lib/axe/api/results/rule.rb b/lib/axe/api/results/rule.rb index abc1234..def5678 100644 --- a/lib/axe/api/results/rule.rb +++ b/lib/axe/api/results/rule.rb @@ -19,7 +19,7 @@ [ title_message(index+1), helpUrl.prepend(" " * 2), - node_count_message + node_count_message.prepend(" " * 2) ].concat(nodes.map(&:failure_message)) end @@ -30,7 +30,7 @@ end def node_count_message - "#{nodes.length} #{nodes.length == 1 ? 'node' : 'nodes'} were found with the violation:".insert(0, " " * 2) + "#{nodes.length} #{nodes.length == 1 ? 'node' : 'nodes'} were found with the violation:" end end end
Prepend indentation in one spot
diff --git a/lib/dm-types/bcrypt_hash.rb b/lib/dm-types/bcrypt_hash.rb index abc1234..def5678 100644 --- a/lib/dm-types/bcrypt_hash.rb +++ b/lib/dm-types/bcrypt_hash.rb @@ -17,7 +17,10 @@ def dump(value) hash = typecast(value) - hash.to_s if hash + return if hash.nil? + hash_string = hash.to_s + hash_string.encode!('UTF-8') if hash_string.respond_to?(:encode!) + hash_string end end # class BCryptHash
Change bcrypt type to dump a utf-8 string if possible * This is required by the yaml adapter to properly serialize the string into something that can be serialized as a string primitive and not a binary string, which is not supported by safe_yaml at the moment.
diff --git a/log-courier.gemspec b/log-courier.gemspec index abc1234..def5678 100644 --- a/log-courier.gemspec +++ b/log-courier.gemspec @@ -6,6 +6,7 @@ gem.homepage = 'https://github.com/driskell/log-courier' gem.authors = ['Jason Woods'] gem.email = ['devel@jasonwoods.me.uk'] + gem.licenses = ['Apache'] gem.rubyforge_project = 'nowarning' gem.require_paths = ['lib'] gem.files = %w(
Add license to gem spec and fix documentation on gem build
diff --git a/lib/language_pack/rails3.rb b/lib/language_pack/rails3.rb index abc1234..def5678 100644 --- a/lib/language_pack/rails3.rb +++ b/lib/language_pack/rails3.rb @@ -2,8 +2,6 @@ require "language_pack/rails2" class LanguagePack::Rails3 < LanguagePack::Rails2 - - JS_RUNTIME_PATH = File.expand_path(File.join(File.dirname(__FILE__), '../../vendor/node/node-0.4.7')) def self.use? super && @@ -37,12 +35,16 @@ super.concat(%w( rails3_serve_static_assets )).uniq end + def binaries + super + ['node/node-0.4.7/node'] + end + def run_assets_precompile_task if rake_task_defined?("assets:precompile") topic("Running assets:precompile task") run("mkdir -p tmp/cache") # need to use a dummy DATABASE_URL here, so rails can load the environment - pipe("env RAILS_ENV=production DATABASE_URL=postgres://user:pass@127.0.0.1/dbname PATH=$PATH:#{JS_RUNTIME_PATH} bundle exec rake assets:precompile 2>&1") + pipe("env RAILS_ENV=production DATABASE_URL=postgres://user:pass@127.0.0.1/dbname PATH=$PATH:bin bundle exec rake assets:precompile 2>&1") unless $?.success? puts "assets:precompile task failed" end
Revert "Revert "bundle node into rails 3 slugs :{"" This reverts commit e9cbc0fe01ea3c0df57e4fa07509c3f992d794b0. Conflicts: lib/language_pack/rails3.rb
diff --git a/app/helpers/profile_helper.rb b/app/helpers/profile_helper.rb index abc1234..def5678 100644 --- a/app/helpers/profile_helper.rb +++ b/app/helpers/profile_helper.rb @@ -10,7 +10,7 @@ end def show_profile_social_tab? - Gitlab.config.omniauth.enabled && !current_user.ldap_user? + enabled_social_providers.any? && !current_user.ldap_user? end def show_profile_remove_tab?
Check if any social providers are enabled.
diff --git a/app/lib/permission_checker.rb b/app/lib/permission_checker.rb index abc1234..def5678 100644 --- a/app/lib/permission_checker.rb +++ b/app/lib/permission_checker.rb @@ -1,12 +1,21 @@ class PermissionChecker GDS_EDITOR_PERMISSION = "gds_editor" + EDITOR_PERMISSION = "editor" def initialize(user) @user = user end def can_edit?(format) - is_gds_editor? || user_organisation_owns_format?(format) + is_gds_editor? || can_access_format?(format) + end + + def can_publish?(format) + is_gds_editor? || is_editor? && can_access_format?(format) + end + + def can_withdraw?(format) + can_publish?(format) end private @@ -14,6 +23,14 @@ def is_gds_editor? user.has_permission?(GDS_EDITOR_PERMISSION) + end + + def is_editor? + user.has_permission?(EDITOR_PERMISSION) + end + + def can_access_format?(format) + format == "manual" || user_organisation_owns_format?(format) end def user_organisation_owns_format?(format)
Add publish and withdraw permission check
diff --git a/lib/nessus/client/policy.rb b/lib/nessus/client/policy.rb index abc1234..def5678 100644 --- a/lib/nessus/client/policy.rb +++ b/lib/nessus/client/policy.rb @@ -4,9 +4,31 @@ module Policy # GET /policy/list def policy_list - resp = get '/policy/list' - resp['reply']['contents']['policies']['policy'] + response = get '/policy/list' + response['reply']['contents']['policies']['policy'] end + + # @!group Policy Auxiliary Methods + + # @return [Array<Array<String>>] an object containing a list of policies + # and their policy IDs + def policies + policy_list.map do |policy| + [policy['policyname'], policy['policyid']] + end + end + + # @return [String] looks up policy ID by policy name + def policy_id_by_name(name) + policy_list.find{|policy| policy['policyname'].eql? name}['policyid'] + end + + # @return [String] looks up policy name by policy ID + def policy_name_by_id(id) + policy_list.find{|policy| policy['policyid'].eql? id}['policyname'] + end + + #@!endgroup end end end
Add auxiliary methods for parsing
diff --git a/lib/onfido/request_error.rb b/lib/onfido/request_error.rb index abc1234..def5678 100644 --- a/lib/onfido/request_error.rb +++ b/lib/onfido/request_error.rb @@ -1,3 +1,20 @@+=begin +The class will handle response failures coming from Onfido +It's main purpose is to produce meaningful error messages to the user e.g. +RequestError: Authorization error: please re-check your credentials + +Users can also rescue the error and insect its type and affected fields as +specified in the Onfido documentation e.g. + +begin + # error being raised +rescue Onfido::RequestError => e + e.type + e.fields +end + +=end + module Onfido class RequestError < StandardError attr_accessor :type, :fields
Add documentation as to how the request errors can be handled
diff --git a/lib/rdl/types/structural.rb b/lib/rdl/types/structural.rb index abc1234..def5678 100644 --- a/lib/rdl/types/structural.rb +++ b/lib/rdl/types/structural.rb @@ -10,7 +10,7 @@ alias :__new__ :new end - def self.new(*methods) + def self.new(methods) t = @@cache[methods] return t if t t = StructuralType.__new__(methods)
Put this back so test cases pass.
diff --git a/lib/tasks/refresh_rate.rake b/lib/tasks/refresh_rate.rake index abc1234..def5678 100644 --- a/lib/tasks/refresh_rate.rake +++ b/lib/tasks/refresh_rate.rake @@ -12,7 +12,7 @@ c.symbol = k c.symbol = [8364].pack("U") if k == "EUR" c.symbol = [36].pack("U") if k == "USD" - c.symbol = [163].pack("U") if k == "GBR" + c.symbol = [163].pack("U") if k == "GBP" c.rate = v c.save puts "update #{k}"
Correct iso code for pound
diff --git a/app/helpers/geocoder_helper.rb b/app/helpers/geocoder_helper.rb index abc1234..def5678 100644 --- a/app/helpers/geocoder_helper.rb +++ b/app/helpers/geocoder_helper.rb @@ -2,7 +2,12 @@ def result_to_html(result) html_options = {} #html_options[:title] = strip_tags(result[:description]) if result[:description] - html_options[:href] = "?mlat=#{result[:lat]}&mlon=#{result[:lon]}&zoom=#{result[:zoom]}" + if result[:min_lon] and result[:min_lat] and result[:max_lon] and result[:max_lat] + html_options[:href] = "?minlon=#{result[:min_lon]}&minlat=#{result[:min_lat]}&maxlon=#{result[:max_lon]}&maxlat=#{result[:max_lat]}" + else + html_options[:href] = "?mlat=#{result[:lat]}&mlon=#{result[:lon]}&zoom=#{result[:zoom]}" + end + html = "" html << result[:prefix] if result[:prefix] html << " " if result[:prefix] and result[:name]
Use the bbox to build the URL if there is one.
diff --git a/app/helpers/services_helper.rb b/app/helpers/services_helper.rb index abc1234..def5678 100644 --- a/app/helpers/services_helper.rb +++ b/app/helpers/services_helper.rb @@ -1,2 +1,13 @@ module ServicesHelper + + def css_class_for_status(status) + { + 'outdated' => 'static', + 'retired' => 'default', + 'proposed' => 'primary', + 'current' => 'success', + 'retracted' => 'warning', + 'rejected' => 'danger' + }[status] + ' btn-status' || '' + end end
Add method to map css_class to service_version helper
diff --git a/app/models/flms/image_layer.rb b/app/models/flms/image_layer.rb index abc1234..def5678 100644 --- a/app/models/flms/image_layer.rb +++ b/app/models/flms/image_layer.rb @@ -1,6 +1,7 @@ module Flms class ImageLayer < Layer - attr_accessible :image, :image_cache + attr_accessible :image, :image_cache, + :image_width, :image_height mount_uploader :image, ImageUploader before_save :retain_geometry @@ -18,10 +19,8 @@ def retain_geometry geometry = self.image.normal.geometry if geometry - # Use a reasonable guesstimate for window size to come up with a starting point - # for % width and height for the image based on it's resolution: - self.width = 900.0 / geometry[0] - self.height = 800.0 / geometry[1] + self.image_width = geometry[0] + self.image_height = geometry[1] end end end
Store image resolution to proper attributes instead of width/height
diff --git a/test/attribute_assembler_test.rb b/test/attribute_assembler_test.rb index abc1234..def5678 100644 --- a/test/attribute_assembler_test.rb +++ b/test/attribute_assembler_test.rb @@ -12,6 +12,10 @@ should 'act like the overwritten field' do assert @person.name.is_a?(String) end + + should 'be transparent' do + assert_equal 'John C. Doe', @person.name + end should 'respond to extension methods' do assert @person.name.has_middle_name? @@ -20,5 +24,13 @@ end end + + should 'not break if the attribute changes for the instance' do + assert_equal 'Doe', @person.name.surname + + @person.name = 'John Smith' + assert_equal 'Smith', @person.name.surname + assert ! @person.name.has_middle_name? + end end
Verify that changing an attribute's value doesn't break anything
diff --git a/BHCDatabase/test/controllers/initiatives_controller_test.rb b/BHCDatabase/test/controllers/initiatives_controller_test.rb index abc1234..def5678 100644 --- a/BHCDatabase/test/controllers/initiatives_controller_test.rb +++ b/BHCDatabase/test/controllers/initiatives_controller_test.rb @@ -7,9 +7,30 @@ log_in_as(@user) end - test "should get new" do + test 'should get new' do get initiatives_new_url + assert_template 'initiatives/new' assert_response :success end + test 'should get index' do + get initiatives_url + assert_response :success + assert_template 'initiatives/index' + end + + test 'should get initiative one' do + one = initiatives(:one) + get initiative_url(one) + assert_response :success + assert_template 'initiatives/show' + end + + test 'should get edit' do + one = initiatives(:one) + get edit_initiative_url(one) + assert_response :success + assert_template 'initiatives/edit' + end + end
Improve controller tests for an initiative.
diff --git a/rom-sql.gemspec b/rom-sql.gemspec index abc1234..def5678 100644 --- a/rom-sql.gemspec +++ b/rom-sql.gemspec @@ -20,7 +20,7 @@ spec.add_runtime_dependency "sequel", "~> 4.18" spec.add_runtime_dependency "equalizer", "~> 0.0", ">= 0.0.9" - spec.add_runtime_dependency "rom", "~> 0.6.0", ">= 0.6.0" + spec.add_runtime_dependency "rom", "~> 0.6.0.beta1" spec.add_development_dependency "bundler" spec.add_development_dependency "rake", "~> 10.0"
Fix rom version spec for beta
diff --git a/test/lib/test_batch_result.rb b/test/lib/test_batch_result.rb index abc1234..def5678 100644 --- a/test/lib/test_batch_result.rb +++ b/test/lib/test_batch_result.rb @@ -0,0 +1,40 @@+require 'test_helper' + +class TestBatchResult < Test::Unit::TestCase + + def setup + @result_created = SalesforceBulk::BatchResult.new('123', true, true, '') + @result_updated = SalesforceBulk::BatchResult.new('123', true, false, '') + @result_failed = SalesforceBulk::BatchResult.new('123', false, false, 'Some Error Message This Is') + end + + test "basic initialization" do + assert_equal @result_created.id, '123' + assert_equal @result_created.success, true + assert_equal @result_created.successful?, true + assert_equal @result_created.created, true + assert_equal @result_created.created?, true + assert_equal @result_created.error, '' + assert_equal @result_created.error?, false + assert_equal @result_created.updated?, false + end + + test "initialization from CSV row" do + #@br = SalesforceBulk::BatchResult.new_from_csv() + end + + test "error?" do + assert @result_failed.error? + + assert !@result_created.error? + assert !@result_updated.error? + end + + test "updated?" do + assert @result_updated.updated? + + assert !@result_created.updated? + assert !@result_failed.updated? + end + +end
Add a complete test for the BatchResult class.
diff --git a/spec/features/likeable_spec.rb b/spec/features/likeable_spec.rb index abc1234..def5678 100644 --- a/spec/features/likeable_spec.rb +++ b/spec/features/likeable_spec.rb @@ -12,20 +12,28 @@ visit post_path(post) end - scenario 'can be liked then unliked' do + scenario 'can be liked' do + expect(page).to have_link 'Like' click_link 'Like' + expect(page).to have_content '1 like' + + visit post_path(post) + expect(page).to have_link 'Unlike' - expect(page).to have_content '1 like' click_link 'Unlike' - expect(page).to have_link 'Like' + expect(page).to have_content '0 likes' end scenario 'displays correct number of likes' do + expect(page).to have_link 'Like' click_link 'Like' expect(page).to have_content '1 like' logout(member) + login_as(another_member) visit post_path(post) + + expect(page).to have_link 'Like' click_link 'Like' expect(page).to have_content '2 likes' end
Update spec to wait for the link to appear
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index abc1234..def5678 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -18,6 +18,7 @@ # Install module and dependencies hosts.each do |host| copy_module_to(host, source: proj_root, module_name: 'bash') + on host, puppet('module install puppet-extlib'), acceptable_exit_codes: [0, 1] on host, puppet('module install puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] end end
Add missing dependency for Beaker tests
diff --git a/config/initializers/metrics.rb b/config/initializers/metrics.rb index abc1234..def5678 100644 --- a/config/initializers/metrics.rb +++ b/config/initializers/metrics.rb @@ -5,7 +5,7 @@ if !Rails.env.test? && File.exists?(metrics_config_file) metrics_config = YAML.load_file(metrics_config_file)[Rails.env] Librato::Metrics.authenticate(metrics_config['email'], metrics_config['api_key']) - LIBRATO_QUEUE = Librato::Metrics::Queue.new(:autosubmit_count => 100, :autosubmit_interval => 10) + LIBRATO_QUEUE = Librato::Metrics::Queue.new(:autosubmit_count => 600, :autosubmit_interval => 60) else LIBRATO_QUEUE = nil end
Increment queue length to reduce request times.
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index abc1234..def5678 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -1,7 +1,7 @@ Sidekiq.configure_server do |config| - config.redis = { url: "redis://#{REDIS_HOST}:6379/0" } + config.redis = { url: "redis://#{ENV['REDIS_HOST']}:6379/0" } end Sidekiq.configure_client do |config| - config.redis = { url: "redis://#{REDIS_HOST}:6379/0" } + config.redis = { url: "redis://#{ENV['REDIS_HOST']}:6379/0" } end
Fix errant ENV reference to REDIS_HOST This is just a typo, and a cost of not having CI running. Mea Culpa on both counts.
diff --git a/lib/sequel_secure_password.rb b/lib/sequel_secure_password.rb index abc1234..def5678 100644 --- a/lib/sequel_secure_password.rb +++ b/lib/sequel_secure_password.rb @@ -39,8 +39,8 @@ def validate super - errors.add :password_digest, 'is not present' if blank? password_digest - errors.add :password, 'has no confirmation' if password != password_confirmation + errors.add :password, 'is not present' if blank? password_digest + errors.add :password, 'has no confirmation' if password != password_confirmation end private
Add errors on :password when digest is missing
diff --git a/db/migrate/20150113184049_change_datetime_timezones.rb b/db/migrate/20150113184049_change_datetime_timezones.rb index abc1234..def5678 100644 --- a/db/migrate/20150113184049_change_datetime_timezones.rb +++ b/db/migrate/20150113184049_change_datetime_timezones.rb @@ -0,0 +1,34 @@+class ChangeDatetimeTimezones < ActiveRecord::Migration + + # set to 1.0.0 migration date + FromDate = ENV['CHANGE_TIMEZONE_FROM'] || '2014/11/24 00:00:00' + + def up + # from local to utc + offset = Time.zone.now.formatted_offset.to_i + apply_offset(-offset) + end + + def down + # from utc to local + offset = Time.zone.now.formatted_offset.to_i + apply_offset(offset) + end + + def apply_offset offset + return unless FromDate.present? + conn = ActiveRecord::Base.connection + + ActiveRecord::Base.transaction do + conn.tables.each do |table| + conn.schema_cache.columns(table).select do |column| + next unless column.sql_type.in? ['timestamp without time zone'] + query = "UPDATE #{table} SET \"#{column.name}\" = \"#{column.name}\" + INTERVAL '#{offset} hour' WHERE \"#{column.name}\" >= '#{FromDate}'" + say query + conn.execute query + end + end + end + end + +end
Fix AR timezone from local to utc
diff --git a/Casks/webstorm-bundled-jdk.rb b/Casks/webstorm-bundled-jdk.rb index abc1234..def5678 100644 --- a/Casks/webstorm-bundled-jdk.rb +++ b/Casks/webstorm-bundled-jdk.rb @@ -0,0 +1,21 @@+cask :v1 => 'webstorm-bundled-jdk' do + version '10.0.1' + sha256 '8b05be91e5c688908d6bcaab4d1f5ead86912d5b33b332a7dd5964dc901090b7' + + url "https://download.jetbrains.com/webstorm/WebStorm-#{version}-custom-jdk-bundled.dmg" + name 'WebStorm' + homepage 'http://www.jetbrains.com/webstorm/' + license :commercial + + app 'WebStorm.app' + binary 'WebStorm.app/Contents/MacOS/webstorm' + + zap :delete => [ + '~/.WebStorm10', + '~/Library/Preferences/com.jetbrains.webstorm.plist', + '~/Library/Preferences/WebStorm10', + '~/Library/Application Support/WebStorm10', + '~/Library/Caches/WebStorm10', + '~/Library/Logs/WebStorm10', + ] +end
Add formula for WebStorm with bundled JDK See #879
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -13,7 +13,7 @@ charset = %w{ 2 3 4 6 7 9 a c d e f g h j k m n p q r t v w x y z} token = (0...3).map{ charset.to_a[rand(charset.size)] }.join REDIS.set(token, params[:text]) - REDIS.expire(token, 60) # 3600 secs = 1 hour + REDIS.expire(token, 600) flash[:success] = "Ok. Scan the QR code or copy the link below to share this item." redirect "/#{token}" end
Change expiration to 10 minutes
diff --git a/app.rb b/app.rb index abc1234..def5678 100644 --- a/app.rb +++ b/app.rb @@ -24,8 +24,7 @@ end configure do - set :session_secret, ENV['SESSION_SECRET'] if ENV['SESSION_SECRET'] - enable :sessions + use Rack::Session::Pool, :secret => (ENV['SESSION_SECRET'] || 'Default secret... Set the SESSION_SECRET environment variable!') # Force enclosure parsing on all Feedzirra feed entries Feedzirra::Feed.add_common_feed_entry_element(:enclosure, :value => :url, :as => :enclosure_url)
Revert the change to the session management : didn't work on AppFog
diff --git a/test/iruby/mime_test.rb b/test/iruby/mime_test.rb index abc1234..def5678 100644 --- a/test/iruby/mime_test.rb +++ b/test/iruby/mime_test.rb @@ -0,0 +1,32 @@+class IRubyTest::MimeTest < IRubyTest::TestBase + sub_test_case("IRuby::Display") do + def test_display_with_mime_type + html = "<b>Bold Text</b>" + + obj = Object.new + obj.define_singleton_method(:to_s) { html } + + res = IRuby::Display.display(obj, mime: "text/html") + assert_equal({ plain: obj.inspect, html: html }, + { plain: res["text/plain"], html: res["text/html"] }) + end + end + + sub_test_case("Rendering a file") do + def setup + @html = "<b>Bold Text</b>" + Dir.mktmpdir do |tmpdir| + @file = File.join(tmpdir, "test.html") + File.write(@file, @html) + yield + end + end + + def test_display + File.open(@file, "rb") do |f| + res = IRuby::Display.display(f) + assert_equal(@html, res["text/html"]) + end + end + end +end
Add a test case to examine mime type handling
diff --git a/config.ru b/config.ru index abc1234..def5678 100644 --- a/config.ru +++ b/config.ru @@ -15,7 +15,7 @@ # ensure Redis is running begin - $redis.info + $redis.ping rescue Redis::CannotConnectError => e fail "Cannot connect to redis at #{REDIS_URL}" end
Change $redis.info as connection test to $redis.ping
diff --git a/0_code_wars/squash_the_bugs.rb b/0_code_wars/squash_the_bugs.rb index abc1234..def5678 100644 --- a/0_code_wars/squash_the_bugs.rb +++ b/0_code_wars/squash_the_bugs.rb @@ -0,0 +1,5 @@+# http://www.codewars.com/kata/56f173a35b91399a05000cb7/ +# --- iteration 1 --- +def find_longest(str) + str.split.map(&:size).max +end
Add code wars (8) - squash the bugs
diff --git a/upstart.gemspec b/upstart.gemspec index abc1234..def5678 100644 --- a/upstart.gemspec +++ b/upstart.gemspec @@ -16,5 +16,6 @@ gem.require_paths = ['lib'] gem.add_development_dependency 'rake' + gem.add_development_dependency 'rspec' gem.add_runtime_dependency 'ruby-dbus', '>= 0.7.2' end
Add rspec to development dependencies.
diff --git a/lib/data_cycle/course_queue_sorting.rb b/lib/data_cycle/course_queue_sorting.rb index abc1234..def5678 100644 --- a/lib/data_cycle/course_queue_sorting.rb +++ b/lib/data_cycle/course_queue_sorting.rb @@ -2,7 +2,7 @@ module CourseQueueSorting def queue_for(course) - case average_update_time(course) + case longest_update_time(course) when nil initial_queue(course) when 0..30 # up to 30 seconds @@ -14,13 +14,13 @@ end end - def average_update_time(course) + def longest_update_time(course) logs = course.flags['update_logs'] return unless logs.present? - total_time = logs.keys.sum do |update_number| + update_times = logs.keys.map do |update_number| logs[update_number]['end_time'].to_f - logs[update_number]['start_time'].to_f end - (total_time / logs.keys.count).to_i + update_times.max.to_i end def initial_queue(course)
Use longest update time instead of average for queue sorting After the recent changes to the update process — where courses in the 'long' queue skip the time-consuming step of checking for deletions and page moves among all the edited articles — we now have very few courses in the 'long' queue, and the 'medium' queue latency is up to 5 days. This is likely because slow-to-update courses move into the medium queue after spending a short amount of time in the long queue, and don't move back to the long queue immediately after one longer update. This slight tweak will hopefully shift the balance closer to having a 'long' queue with high latency and a 'medium' queue with at most a day of latency.
diff --git a/app/helpers/collection_helper.rb b/app/helpers/collection_helper.rb index abc1234..def5678 100644 --- a/app/helpers/collection_helper.rb +++ b/app/helpers/collection_helper.rb @@ -5,7 +5,9 @@ if column == 'name' value = resource.send(column) - if value.blank? && alternative_value.present? + if alternative_value.is_a?(Proc) + return alternative_value.call(resource) + elsif value.blank? && alternative_value.present? value = eval("resource.#{alternative_value}") elsif value.blank? value = '-'
Allow a proc as an alternative table cell value.
diff --git a/cookbooks/storm/recipes/undeploy-nimbus.rb b/cookbooks/storm/recipes/undeploy-nimbus.rb index abc1234..def5678 100644 --- a/cookbooks/storm/recipes/undeploy-nimbus.rb +++ b/cookbooks/storm/recipes/undeploy-nimbus.rb @@ -28,7 +28,6 @@ runit_service "stormui" do action :disable - run_restart false end # try to stop the service, but allow a failure without printing the error
Fix to storm cookbook with new runit.
diff --git a/lib/generator/files/generator_cases.rb b/lib/generator/files/generator_cases.rb index abc1234..def5678 100644 --- a/lib/generator/files/generator_cases.rb +++ b/lib/generator/files/generator_cases.rb @@ -23,8 +23,8 @@ Dir.glob(generator_glob, File::FNM_DOTMATCH) end - def exercise_name(filename) - %r{([^/]*)_cases\.rb$}.match(filename).captures[0].tr('_', '-') + def exercise_name(filepath) + %r{([^/]*)_cases\.rb$}.match(filepath).captures[0].tr('_', '-') end def filename(exercise_name)
Rename exercise_name argument for consistency.
diff --git a/test/test_toc_parser.rb b/test/test_toc_parser.rb index abc1234..def5678 100644 --- a/test/test_toc_parser.rb +++ b/test/test_toc_parser.rb @@ -0,0 +1,35 @@+require 'test_helper' +require_relative '../lib/jekyll-toc' + + +class TestTOCParser < Minitest::Test + SIMPLE_HTML = <<EOL +<h1>Simple H1</h1> +<h2>Simple H2</h2> +<h3>Simple H3</h3> +<h4>Simple H4</h4> +<h5>Simple H5</h5> +<h6>Simple H6</h6> +EOL + + def setup + @data = SIMPLE_HTML + @parser = Jekyll::TableOfContentsFilter::Parser.new + end + + def test_example_html_is_loaded + assert_match /Simple H1/, @data + end + + def test_injects_anchors + html = @parser.toc(@data) + + assert_match /<a id="simple\-h1" class="anchor" href="#simple\-h1" aria\-hidden="true"><span.*span><\/a>Simple H1/, html + end + + def test_injects_toc_container + html = @parser.toc(@data) + + assert_match /<ul class="section-nav">/, html + end +end
Add basic test case for TOC parser tests: - injecting anchor tags - injecting toc container Signed-off-by: Torbjörn Klatt <279a4cf6d7f8da1ddc113bb946b9273d9d938683@torbjoern-klatt.de>
diff --git a/vendor/extensions/clipped-extension/lib/clipped/engine.rb b/vendor/extensions/clipped-extension/lib/clipped/engine.rb index abc1234..def5678 100644 --- a/vendor/extensions/clipped-extension/lib/clipped/engine.rb +++ b/vendor/extensions/clipped-extension/lib/clipped/engine.rb @@ -1,7 +1,7 @@ require 'acts_as_list' require 'uuidtools' require 'trusty_cms_clipped_extension/cloud' -require 'paperclip' +require 'active_storage/engine' require 'will_paginate/array' module Clipped class Engine < Rails::Engine
Remove paperclip and replace with active storage
diff --git a/BHCDatabase/test/models/removed_initiative_funding_test.rb b/BHCDatabase/test/models/removed_initiative_funding_test.rb index abc1234..def5678 100644 --- a/BHCDatabase/test/models/removed_initiative_funding_test.rb +++ b/BHCDatabase/test/models/removed_initiative_funding_test.rb @@ -1,7 +1,33 @@ require 'test_helper' +# RemovedInitiativeFundingTest is the generic model test for a removed +# initiative funder. class RemovedInitiativeFundingTest < ActiveSupport::TestCase - # test "the truth" do - # assert true - # end -end + def setup + @removed_init_funder = removed_initiative_fundings(:one) + end + + test 'should be valid' do + assert @removed_init_funder.valid? + end + + test 'datetime should accept valid dates' do + valid_date = '01/01/2012 23:59:59' + @removed_init_funder.date_given = valid_date + assert @removed_init_funder.date_given.to_datetime.is_a?(DateTime) + end + + test 'datetime should reject invalid dates' do + invalid_date = '12/13/2016' + @removed_init_funder.date_given = invalid_date + assert_raises(Exception) { @removed_init_funder.date_given.to_datetime } + end + + test 'should accept duplicate entries' do + @duplicate_removed_funder = @removed_init_funder.dup + assert @duplicate_removed_funder.valid? + assert_difference 'RemovedInitiativeFunding.count', 1 do + @duplicate_removed_funder.save + end + end +end
Add model tests for a removed initiative funder.
diff --git a/middleman-breadcrumbs.gemspec b/middleman-breadcrumbs.gemspec index abc1234..def5678 100644 --- a/middleman-breadcrumbs.gemspec +++ b/middleman-breadcrumbs.gemspec @@ -13,7 +13,7 @@ s.license = 'MIT' s.add_runtime_dependency "middleman", '>= 3.3.5' - ['byebug', ['guard', '~> 2.10.5'], 'guard-minitest', 'ffaker'].each {|gem| s.add_development_dependency *gem } + ['byebug', ['guard', '~> 2.10.5'], 'guard-minitest', 'ffaker', 'rake'].each {|gem| s.add_development_dependency *gem } s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Add Rake as dev dependency.
diff --git a/acceptance/setup/pre_suite/70_install_released_puppetdb.rb b/acceptance/setup/pre_suite/70_install_released_puppetdb.rb index abc1234..def5678 100644 --- a/acceptance/setup/pre_suite/70_install_released_puppetdb.rb +++ b/acceptance/setup/pre_suite/70_install_released_puppetdb.rb @@ -1,8 +1,8 @@ # We skip this step entirely unless we are running in :upgrade mode. if (test_config[:install_mode] == :upgrade) step "Install most recent released PuppetDB on the PuppetDB server for upgrade test" do - install_puppetdb(database, test_config[:database]) + install_puppetdb(database, test_config[:database], 'latest') start_puppetdb(database) - install_puppetdb_termini(master, database) + install_puppetdb_termini(master, database, 'latest') end end
Revert "(maint) make install_puppetdb and install_puppetdb_terminus versions nil"
diff --git a/aggregate_root/lib/aggregate_root/default_apply_strategy.rb b/aggregate_root/lib/aggregate_root/default_apply_strategy.rb index abc1234..def5678 100644 --- a/aggregate_root/lib/aggregate_root/default_apply_strategy.rb +++ b/aggregate_root/lib/aggregate_root/default_apply_strategy.rb @@ -27,7 +27,7 @@ end def event_type(event_type) - event_type.split("::").last + event_type.split(%r{::|\.}).last end private
Split Ruby and Proto namespaces. In Proto events we cannot use :: for namespace delimiters. Dot is used instead.
diff --git a/app/controllers/ecm/pictures/backend/pictures_controller.rb b/app/controllers/ecm/pictures/backend/pictures_controller.rb index abc1234..def5678 100644 --- a/app/controllers/ecm/pictures/backend/pictures_controller.rb +++ b/app/controllers/ecm/pictures/backend/pictures_controller.rb @@ -1,4 +1,21 @@ class Ecm::Pictures::Backend::PicturesController < Itsf::Backend::Resource::BaseController + module ColumnsHashFix + extend ActiveSupport::Concern + + included do + before_action :fix_columns_hash, only: [:update] + end + + private + + def fix_columns_hash + # @todo Find out what is causing the loss of columns in columns_hash + resource_class.reset_column_information + end + end + + include ColumnsHashFix + def self.resource_class Ecm::Pictures::Picture end @@ -20,7 +37,7 @@ def permitted_params processed_params = params.deep_dup image_base64 = processed_params[:picture].try(:delete, :image_base64) - + p = processed_params.require(:picture).permit(:gallery_id, :name, :markup_language, :description, :tag_list, :image) if image_base64.present?
Add quick fix for columns hash missing columns on picture update.
diff --git a/features/step_definitions/preview_steps.rb b/features/step_definitions/preview_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/preview_steps.rb +++ b/features/step_definitions/preview_steps.rb @@ -9,7 +9,7 @@ end When(/^I click the preview button$/) do - find_button("Preview").trigger('click') + click_button "Preview" end Then(/^I should see the map preview$/) do
Simplify statement in cucumber test steps Use click_button instead of find_button().trigger('click')
diff --git a/models/match.rb b/models/match.rb index abc1234..def5678 100644 --- a/models/match.rb +++ b/models/match.rb @@ -11,7 +11,7 @@ end # Custom methods. - attr_reader :round, :number + attr_reader :number, :round def initialize(string) @replay = false
MatchNumber: Swap around ordering of attr_readers. This isn't very important, but it's alphabetical now! :D
diff --git a/db/migrate/20111019013244_postgresql_photos_id_seq_init.rb b/db/migrate/20111019013244_postgresql_photos_id_seq_init.rb index abc1234..def5678 100644 --- a/db/migrate/20111019013244_postgresql_photos_id_seq_init.rb +++ b/db/migrate/20111019013244_postgresql_photos_id_seq_init.rb @@ -0,0 +1,11 @@+class PostgresqlPhotosIdSeqInit < ActiveRecord::Migration + def self.up + if postgres? + execute "SELECT setval('photos_id_seq', COALESCE( ( SELECT MAX(id)+1 FROM photos ), 1 ) )" + end + end + + def self.down + # No reason or need to migrate this down. + end +end
Set photos_id_seq properly for PostgreSQL (re: recent "MovePhotosToTheirOwnTable" migration, which neglected to do this).
diff --git a/lib/capistrano/ec2/capistrano_monkey_patch.rb b/lib/capistrano/ec2/capistrano_monkey_patch.rb index abc1234..def5678 100644 --- a/lib/capistrano/ec2/capistrano_monkey_patch.rb +++ b/lib/capistrano/ec2/capistrano_monkey_patch.rb @@ -8,7 +8,11 @@ region: fetch(:region), use_iam_profile: fetch(:use_iam_profile, false) - filters = { "tag:ec2_env" => ec2_env, "tag:role" => ec2_role } + filters = { + "tag:ec2_env" => ec2_env, + "tag:role" => ec2_role, + 'instance-state-name': 'running' + } ec2.servers.all(filters).map.with_index do |ec2_server, index| next unless ec2_server.ready?
Add filter to ensure "running" instances Query only for "running" instances, make sure we're not targeting terminated instances.
diff --git a/lib/filter_factory/active_record/condition.rb b/lib/filter_factory/active_record/condition.rb index abc1234..def5678 100644 --- a/lib/filter_factory/active_record/condition.rb +++ b/lib/filter_factory/active_record/condition.rb @@ -26,7 +26,7 @@ end def all(_obj) - fail NotImplementedError, "all operator is not available for ActiveRecord" + fail NotImplementedError, 'all operator is not available for ActiveRecord' end def is_in(obj) @@ -42,7 +42,7 @@ end def exists(_obj) - fail NotImplementedError, "exists operator is not available for ActiveRecord" + fail NotImplementedError, 'exists operator is not available for ActiveRecord' end def presents(obj)
Use single-quoted strings without interpolation.
diff --git a/config/initializers/prisons.rb b/config/initializers/prisons.rb index abc1234..def5678 100644 --- a/config/initializers/prisons.rb +++ b/config/initializers/prisons.rb @@ -2,7 +2,7 @@ Dir["config/prisons/*.yml"].each { |file| prison = YAML.load_file(file) - unless Rails.env.production? + if ENV['GSI_SMTP_HOSTNAME'] == 'maildrop.dsd.io' || Rails.env.test? prison['email'] = "pvb.#{prison['nomis_id']}@maildrop.dsd.io" end Prison.create(prison)
Send to maildrop in test or based on env This was being selected for everything but production, but preprod, of course, runs in production mode, so it wasn't working. This fixes that.
diff --git a/lib/homepage_publisher.rb b/lib/homepage_publisher.rb index abc1234..def5678 100644 --- a/lib/homepage_publisher.rb +++ b/lib/homepage_publisher.rb @@ -19,13 +19,14 @@ ], "publishing_app": "frontend", "rendering_app": "frontend", - "public_updated_at": Time.zone.now.iso8601 + "public_updated_at": Time.zone.now.iso8601, + "update_type": "major", } end def self.publish!(publishing_api, logger) logger.info("Publishing exact route /, routing to frontend") publishing_api.put_content(CONTENT_ID, homepage_content_item) - publishing_api.publish(CONTENT_ID, "major") + publishing_api.publish(CONTENT_ID) end end
Stop sending update_type on publish Sending it on publish has been deprecated in favour of including it when sending a put content.
diff --git a/lib/manageiq/ui/engine.rb b/lib/manageiq/ui/engine.rb index abc1234..def5678 100644 --- a/lib/manageiq/ui/engine.rb +++ b/lib/manageiq/ui/engine.rb @@ -1,6 +1,7 @@ module Manageiq module Ui class Engine < ::Rails::Engine + config.autoload_paths << File.expand_path(File.join('..', '..', '..', '..', 'app', 'controllers', 'mixins'), __FILE__) end end end
Add autoload path for controller mixins.
diff --git a/lib/mongo_oplog_backup.rb b/lib/mongo_oplog_backup.rb index abc1234..def5678 100644 --- a/lib/mongo_oplog_backup.rb +++ b/lib/mongo_oplog_backup.rb @@ -19,5 +19,5 @@ Command.logger = log end - @@log = Logger.new STDOUT + MongoOplogBackup.log = Logger.new STDOUT end
Fix command output not being logged.
diff --git a/XCDLumberjackNSLogger.podspec b/XCDLumberjackNSLogger.podspec index abc1234..def5678 100644 --- a/XCDLumberjackNSLogger.podspec +++ b/XCDLumberjackNSLogger.podspec @@ -1,16 +1,17 @@ Pod::Spec.new do |s| - s.name = "XCDLumberjackNSLogger" - s.version = "1.0.2" - s.summary = "A CocoaLumberjack logger which sends logs to NSLogger" - s.homepage = "https://github.com/0xced/XCDLumberjackNSLogger" - s.license = { :type => "MIT", :file => "LICENSE" } - s.author = { "Cédric Luthi" => "cedric.luthi@gmail.com" } - s.social_media_url = "http://twitter.com/0xced" - s.ios.deployment_target = "5.0" - s.osx.deployment_target = "10.7" - s.source = { :git => "https://github.com/0xced/XCDLumberjackNSLogger.git", :tag => s.version.to_s } - s.source_files = "XCDLumberjackNSLogger.{h,m}" - s.requires_arc = true + s.name = "XCDLumberjackNSLogger" + s.version = "1.0.2" + s.summary = "A CocoaLumberjack logger which sends logs to NSLogger" + s.homepage = "https://github.com/0xced/XCDLumberjackNSLogger" + s.license = { :type => "MIT", :file => "LICENSE" } + s.author = { "Cédric Luthi" => "cedric.luthi@gmail.com" } + s.social_media_url = "http://twitter.com/0xced" + s.ios.deployment_target = "5.0" + s.osx.deployment_target = "10.7" + s.tvos.deployment_target = "9.0" + s.source = { :git => "https://github.com/0xced/XCDLumberjackNSLogger.git", :tag => s.version.to_s } + s.source_files = "XCDLumberjackNSLogger.{h,m}" + s.requires_arc = true s.dependency "CocoaLumberjack", "~> 2.0" s.dependency "NSLogger", "~> 1.5"
Add tvOS deployment target in podspec
diff --git a/lib/pg_search/document.rb b/lib/pg_search/document.rb index abc1234..def5678 100644 --- a/lib/pg_search/document.rb +++ b/lib/pg_search/document.rb @@ -1,5 +1,4 @@ require "logger" -require "pg_search/scope" module PgSearch class Document < ActiveRecord::Base
Remove require that is obviated by autoload
diff --git a/lib/rollbar/truncation/strings_strategy.rb b/lib/rollbar/truncation/strings_strategy.rb index abc1234..def5678 100644 --- a/lib/rollbar/truncation/strings_strategy.rb +++ b/lib/rollbar/truncation/strings_strategy.rb @@ -14,11 +14,12 @@ def call(payload) result = nil + new_payload = payload.clone STRING_THRESHOLDS.each do |threshold| - new_payload = payload.clone + truncate_proc = truncate_strings_proc(threshold) - ::Rollbar::Util.iterate_and_update(payload, truncate_strings_proc(threshold)) + ::Rollbar::Util.iterate_and_update(new_payload, truncate_proc) result = dump(new_payload) return result unless truncate?(result)
Clone payload just once in StringsStrategy.
diff --git a/app/actions/reindex_everything.rb b/app/actions/reindex_everything.rb index abc1234..def5678 100644 --- a/app/actions/reindex_everything.rb +++ b/app/actions/reindex_everything.rb @@ -13,7 +13,7 @@ ids << document.id rescue Exception => e counter += 1 - LifecycleMailer.exception_notification(e,options).deliver + #LifecycleMailer.exception_notification(e,options).deliver retry if counter < 5 end end
Disable email notifications for reindexing.
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index abc1234..def5678 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2,16 +2,4 @@ def facet_options(form, facet) form.object.facet_options(facet) end - - def state(document) - state = document.publication_state - - if document.publication_state == "draft" - classes = "label label-primary" - else - classes = "label label-default" - end - - content_tag(:span, state, class: classes) - end end
Remove unused methods in ApplicationHelper This was moved to the StateHelper
diff --git a/app/inputs/carnival_enum_input.rb b/app/inputs/carnival_enum_input.rb index abc1234..def5678 100644 --- a/app/inputs/carnival_enum_input.rb +++ b/app/inputs/carnival_enum_input.rb @@ -1,6 +1,6 @@ class CarnivalEnumInput < SimpleForm::Inputs::CollectionSelectInput - def input(wrapper_options) + def input(wrapper_options = nil) options[:collection] ||= get_collection super end
Fix CarnivalEnumInput default nil parameter value in input method
diff --git a/app/models/class_list_snapshot.rb b/app/models/class_list_snapshot.rb index abc1234..def5678 100644 --- a/app/models/class_list_snapshot.rb +++ b/app/models/class_list_snapshot.rb @@ -9,9 +9,14 @@ def self.snapshot_all_workspaces snapshots_taken = [] + puts "ClassListSnapshot.snapshot_all_workspaces: starting..." + workspaces = ClassList.unsafe_all_workspaces_without_authorization_check + puts " snapshot_all_workspaces: Found #{workspaces.size} workspaces." ClassList.unsafe_all_workspaces_without_authorization_check.each do |workspace| + puts " snapshot_all_workspaces: Checking workspace #{workspace.workspace_id}..." snapshot = workspace.class_list.snapshot_if_changed if snapshot.present? + puts " snapshot_all_workspaces: created snapshot." snapshots_taken << { snapshot: snapshot, workspace_id: workspace.workspace_id, @@ -19,6 +24,8 @@ } end end + puts " snapshot_all_workspaces: created #{snapshots_taken} snapshots." + puts "ClassListSnapshot.snapshot_all_workspaces: done." snapshots_taken end
Add logging for class list snapshot
diff --git a/app/services/csv_generator.rb b/app/services/csv_generator.rb index abc1234..def5678 100644 --- a/app/services/csv_generator.rb +++ b/app/services/csv_generator.rb @@ -1,6 +1,6 @@ class CsvGenerator def to_csv(submissions) - column_names = Submission.column_names + column_names = ["full_name", "email"] CSV.generate do |csv| csv << column_names submissions.each do |submission|
Save only user's name and email to genrated csv files
diff --git a/app/use_cases/clone_repository.rb b/app/use_cases/clone_repository.rb index abc1234..def5678 100644 --- a/app/use_cases/clone_repository.rb +++ b/app/use_cases/clone_repository.rb @@ -26,6 +26,7 @@ add_pre_condition(CommitsRequired.new(repository)) add_pre_condition(RepositoryRateLimiting.new(user)) add_pre_condition(AuthorizationRequired.new(app, user, repository)) - step(CloneRepositoryCommand.new(app, repository, user)) + command = CloneRepositoryCommand.new(app, repository, user) + step(command, :validator => RepositoryValidator) end end
Validate repository clones as well
diff --git a/app/models/permission.rb b/app/models/permission.rb index abc1234..def5678 100644 --- a/app/models/permission.rb +++ b/app/models/permission.rb @@ -1,4 +1,6 @@ class Permission < ActiveRecord::Base + outpost_model + #------------------- # Association has_many :user_permissions
Make Permissions an outpost model
diff --git a/spec/strategies/completion_spec.rb b/spec/strategies/completion_spec.rb index abc1234..def5678 100644 --- a/spec/strategies/completion_spec.rb +++ b/spec/strategies/completion_spec.rb @@ -4,7 +4,7 @@ -> do session. run_command('autoload compinit && compinit'). - run_command('_foo() { compadd bar }'). + run_command('_foo() { compadd bar; compadd bat }'). run_command('compdef _foo baz') end end
Add an extra completion to better exercise choosing first
diff --git a/app/controllers/enrollment_semesters_controller.rb b/app/controllers/enrollment_semesters_controller.rb index abc1234..def5678 100644 --- a/app/controllers/enrollment_semesters_controller.rb +++ b/app/controllers/enrollment_semesters_controller.rb @@ -1,4 +1,6 @@ class EnrollmentSemestersController < ApplicationController + + load_and_authorize_resource def edit @semester = EnrollmentSemester.find(params[:id])
Add authorization to enrollment semesters Change-Id: I36077e28b1a55fa0b4b3105477aa9977d0f271a5
diff --git a/app/presenters/statistics_filter_json_presenter.rb b/app/presenters/statistics_filter_json_presenter.rb index abc1234..def5678 100644 --- a/app/presenters/statistics_filter_json_presenter.rb +++ b/app/presenters/statistics_filter_json_presenter.rb @@ -1,4 +1,9 @@ class StatisticsFilterJsonPresenter < DocumentFilterPresenter + def as_json(options = nil) + super.merge atom_feed_url: context.filter_atom_feed_url, + email_signup_url: context.new_email_signups_path(email_signup: { feed: context.filter_atom_feed_url }) + end + def result_type "statistic" end
Set the atom and email URLs for the statistics filter
diff --git a/app/views/events/team_scoreboards/show.xml.builder b/app/views/events/team_scoreboards/show.xml.builder index abc1234..def5678 100644 --- a/app/views/events/team_scoreboards/show.xml.builder +++ b/app/views/events/team_scoreboards/show.xml.builder @@ -4,7 +4,8 @@ @team_ranking.ranking.each_with_index do |row, index| xml.Entrant do xml.CompetitionNo "00#{index + 1}" - xml.Name "#{row.team.name} (#{row.team.competitors.map(&:name).join(', ')})" + xml.Name row.team.name + xml.Members row.team.competitors.map(&:name).join(', ') xml.Nation '' xml.Rank index + 1 xml.Total format('%.1f', row.total_points)
Move members to dedicated field
diff --git a/app/controllers/regions_controller.rb b/app/controllers/regions_controller.rb index abc1234..def5678 100644 --- a/app/controllers/regions_controller.rb +++ b/app/controllers/regions_controller.rb @@ -1,6 +1,4 @@ class RegionsController < ApplicationController - # Include Inherited Resources behaviour - inherit_resources layout 'home' @@ -24,4 +22,4 @@ @depth ||= params[:depth] || 1 end -end+end
Remove inherited resources from regions controller
diff --git a/app/overrides/contact_us_in_header.rb b/app/overrides/contact_us_in_header.rb index abc1234..def5678 100644 --- a/app/overrides/contact_us_in_header.rb +++ b/app/overrides/contact_us_in_header.rb @@ -1,5 +1,5 @@ Deface::Override.new(:virtual_path => "spree/shared/_main_nav_bar", :name => "contact_us_in_header", - :insert_bottom => "#main-nav-bar", - :text => "<li class='<%= (request.fullpath.gsub('//','/') == '/contact-us') ? 'current' : 'not'%>'><%= link_to Spree.t(:contact_us_title), '/contact-us' %></li>", + :insert_bottom => "#main-nav-bar .nav.navbar-nav:first-child", + :text => "<li class='<%= (request.fullpath.gsub('//','/') == '/contact-us') ? 'active' : ''%>'><%= link_to Spree.t(:contact_us_title), '/contact-us' %></li>", :original => '442eefbb91b46a8773ce1de620f8f0a88a66caf1')
Fix override positioning and bootstrap classes
diff --git a/spec/conversion_protocol_spec.rb b/spec/conversion_protocol_spec.rb index abc1234..def5678 100644 --- a/spec/conversion_protocol_spec.rb +++ b/spec/conversion_protocol_spec.rb @@ -1,37 +1,40 @@ require 'spec_helper' describe 'Conversion protocol' do - it "converts a string to a BigDecimal" do - '42'.to_bd.should == BigDecimal('42') + describe "for numeric types" do + it "converts a BigDecimal to a BigDecimal" do + foo = BigDecimal('42') + foo.to_bd.should == foo + end + + it "converts an integer to a BigDecimal" do + 42.to_bd.should == BigDecimal('42') + end + + it "converts a float to a BigDecimal" do + 1.23.to_bd.should == BigDecimal('1.23') + end end - it "converts a float to a BigDecimal" do - 1.23.to_bd.should == BigDecimal('1.23') - end + describe "for strings" do + it "converts a string to a BigDecimal" do + '42'.to_bd.should == BigDecimal('42') + end - it "converts a BigDecimal to a BigDecimal" do - foo = BigDecimal('42') - foo.to_bd.should == foo - end + it "converts a string with commas to a BigDecimal" do + '42,000'.to_bd.should == BigDecimal('42000') + end - it "converts a BigDecimal to itself" do - foo = BigDecimal('42') - foo.to_bd.should be(foo) - end + it "converts a string with dollar signs to a BigDecimal" do + '$42,000'.to_bd.should == BigDecimal('42000') + end - it "converts a string with commas to a BigDecimal" do - '42,000'.to_bd.should == BigDecimal('42000') - end + it "doesn't drop decimals either" do + '$42,000.42'.to_bd.should == BigDecimal('42000.42') + end - it "converts a string with dollar signs to a BigDecimal" do - '$42,000'.to_bd.should == BigDecimal('42000') - end - - it "doesn't drop decimals either" do - '$42,000.42'.to_bd.should == BigDecimal('42000.42') - end - - it "groks negative numbers" do # oops - '-42,000.42'.to_bd.should == BigDecimal('-42000.42') + it "groks negative numbers" do # oops + '-42,000.42'.to_bd.should == BigDecimal('-42000.42') + end end end
Reorganize specs for conversion protocol
diff --git a/spec/factories/delivery_links.rb b/spec/factories/delivery_links.rb index abc1234..def5678 100644 --- a/spec/factories/delivery_links.rb +++ b/spec/factories/delivery_links.rb @@ -2,7 +2,7 @@ FactoryGirl.define do factory :delivery_link do - delivery_id 1 - link_id 1 + delivery + link end end
Fix up tests after adding foreign key constraints
diff --git a/app/services/note_creation_service.rb b/app/services/note_creation_service.rb index abc1234..def5678 100644 --- a/app/services/note_creation_service.rb +++ b/app/services/note_creation_service.rb @@ -39,6 +39,6 @@ usernames = UsernameParser.parse(note.note) return [] if usernames.empty? - story.users.where(username: usernames).all + story.users.where(username: usernames) end end
Remove more verbose use of all
diff --git a/app/validators/namespace_validator.rb b/app/validators/namespace_validator.rb index abc1234..def5678 100644 --- a/app/validators/namespace_validator.rb +++ b/app/validators/namespace_validator.rb @@ -24,6 +24,7 @@ projects public repository + robots.txt s search services
Add `robots.txt` to the list of reserved namespaces
diff --git a/lib/generators/templates/keeper.rb b/lib/generators/templates/keeper.rb index abc1234..def5678 100644 --- a/lib/generators/templates/keeper.rb +++ b/lib/generators/templates/keeper.rb @@ -13,13 +13,16 @@ # ES256 - ECDSA using P-256 and SHA-256 # ES384 - ECDSA using P-384 and SHA-384 # ES512 - ECDSA using P-521 and SHA-512 - # config.hashing_method = 'HS512', + # config.algorithm = 'HS512' + + # the secret in which you data is hash with + # config.secret = 'secret' # the issuer of the tokens - # config.issuer = 'api.example.com', + # config.issuer = 'api.example.com' # the default audience of the tokens - # config.default_audience = 'example.com', + # config.audience = 'example.com' # the location of redis config file # config.redis_connection = Redis.new(connection_options)
Fix issues with install template being out of date
diff --git a/lib/octocatalog-diff/facts/yaml.rb b/lib/octocatalog-diff/facts/yaml.rb index abc1234..def5678 100644 --- a/lib/octocatalog-diff/facts/yaml.rb +++ b/lib/octocatalog-diff/facts/yaml.rb @@ -21,8 +21,18 @@ fact_file_data = fact_file_string.split(/\n/) fact_file_data[0] = '---' if fact_file_data[0] =~ /^---/ - # Load and return the parsed fact file. - result = YAML.load(fact_file_data.join("\n")) + # Load the parsed fact file. + parsed = YAML.load(fact_file_data.join("\n")) + + # This is a handler for a YAML file that has just the facts and none of the + # structure. For example if you saved the output of `facter -y` to a file and + # are passing that in, this will work. + result = if parsed.key?('name') && parsed.key?('values') + parsed + else + { 'name' => node || parsed['fqdn'] || '', 'values' => parsed } + end + result['name'] = node unless node == '' result end
Allow unstructured facts in YAML (e.g. facter output)
diff --git a/lib/similarweb/estimated_visits.rb b/lib/similarweb/estimated_visits.rb index abc1234..def5678 100644 --- a/lib/similarweb/estimated_visits.rb +++ b/lib/similarweb/estimated_visits.rb @@ -1,4 +1,4 @@-require 'Date' +require 'date' module Similarweb module EstimatedVisits def estimated_visits(domain)
Use library date with downcase d
diff --git a/lib/sunat/models/payment_amount.rb b/lib/sunat/models/payment_amount.rb index abc1234..def5678 100644 --- a/lib/sunat/models/payment_amount.rb +++ b/lib/sunat/models/payment_amount.rb @@ -22,7 +22,7 @@ end def build_xml(xml, tag_name) - xml[xml_namespace].send(tag_name, { currencyId: currency }, to_s) + xml[xml_namespace].send(tag_name, { currencyID: currency }, to_s) end def int_part
Fix to set the right tag.
diff --git a/src/org/jruby/duby/duby_command.rb b/src/org/jruby/duby/duby_command.rb index abc1234..def5678 100644 --- a/src/org/jruby/duby/duby_command.rb +++ b/src/org/jruby/duby/duby_command.rb @@ -0,0 +1,17 @@+require 'java' +require 'duby' + +java_package "org.jruby.duby" +class DubyCommand + java_signature "void main(String[])" + def self.main(args) + rb_args = args.to_a + command = rb_args.shift.to_s + case command + when "compile" + Duby.compile(*rb_args) + when "run" + Duby.run(*rb_args) + end + end +end
Add a DubyCommand class to be the main class for Duby's executable jar.
diff --git a/zipline.gemspec b/zipline.gemspec index abc1234..def5678 100644 --- a/zipline.gemspec +++ b/zipline.gemspec @@ -15,7 +15,7 @@ gem.require_paths = ["lib"] gem.version = Zipline::VERSION - gem.add_dependency 'zip_tricks', ['>= 4.0.0', '<= 5.0.0'] + gem.add_dependency 'zip_tricks', ['>= 4.2.1', '<= 5.0.0'] gem.add_dependency 'rails', ['>= 3.2.1', '< 5.1'] gem.add_dependency 'curb', ['>= 0.8.0', '< 0.10'] end
Update the gemspec to use zip_tricks version with uniquify duplicate filenames
diff --git a/spec/ruby-progressbar/calculators/length_calculator_spec.rb b/spec/ruby-progressbar/calculators/length_calculator_spec.rb index abc1234..def5678 100644 --- a/spec/ruby-progressbar/calculators/length_calculator_spec.rb +++ b/spec/ruby-progressbar/calculators/length_calculator_spec.rb @@ -4,7 +4,9 @@ class ProgressBar module Calculators RSpec.describe Length do - if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('1.9.3') + if RUBY_PLATFORM != 'java' && + Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('1.9.3') + it 'can properly calculate the length even if IO.console is nil' do calculator = Length.new
Tests: Fix ruby version check on JRuby
diff --git a/pt_online_migration.gemspec b/pt_online_migration.gemspec index abc1234..def5678 100644 --- a/pt_online_migration.gemspec +++ b/pt_online_migration.gemspec @@ -4,7 +4,7 @@ require 'pt_online_migration/version' Gem::Specification.new do |spec| - spec.name = "pt_online_migration" + spec.name = "pt-online-migration" spec.version = PtOnlineMigration::VERSION spec.authors = ['LeadKarma, LLC'] spec.email = ['support@leadkarma.com']
Fix gem name to match readme
diff --git a/test/test_epub.rb b/test/test_epub.rb index abc1234..def5678 100644 --- a/test/test_epub.rb +++ b/test/test_epub.rb @@ -0,0 +1,16 @@+require_relative 'helper' +require 'epub/book' + +class TestEUPB < Test::Unit::TestCase + def setup + @file = 'test/fixtures/book.epub' + end + + def test_parse + book = EPUB::Book.new + assert_nothing_raised do + book.parse @file + end + end +end +
Add test for EPUB module
diff --git a/db/migrate/20160912160750_change_retires_on_to_datetime.rb b/db/migrate/20160912160750_change_retires_on_to_datetime.rb index abc1234..def5678 100644 --- a/db/migrate/20160912160750_change_retires_on_to_datetime.rb +++ b/db/migrate/20160912160750_change_retires_on_to_datetime.rb @@ -0,0 +1,21 @@+class ChangeRetiresOnToDatetime < ActiveRecord::Migration[5.0] + def up + change_column :vms, :retires_on, :datetime + change_column :services, :retires_on, :datetime + change_column :orchestration_stacks, :retires_on, :datetime + + change_column :vms, :retirement_last_warn, :datetime + change_column :services, :retirement_last_warn, :datetime + change_column :orchestration_stacks, :retirement_last_warn, :datetime + end + + def down + change_column :vms, :retires_on, :date + change_column :services, :retires_on, :date + change_column :orchestration_stacks, :retires_on, :date + + change_column :vms, :retirement_last_warn, :date + change_column :services, :retirement_last_warn, :date + change_column :orchestration_stacks, :retirement_last_warn, :date + end +end
Migrate retires_on and retirement_last_warn to datetime https://bugzilla.redhat.com/show_bug.cgi?id=1316632
diff --git a/lib/chef/knife/brightbox_zone_list.rb b/lib/chef/knife/brightbox_zone_list.rb index abc1234..def5678 100644 --- a/lib/chef/knife/brightbox_zone_list.rb +++ b/lib/chef/knife/brightbox_zone_list.rb @@ -0,0 +1,42 @@+# +# Author:: Seth Chisamore (<schisamo@opscode.com>) +# Copyright:: Copyright (c) 2011 Opscode, Inc. +# License:: Apache License, Version 2.0 +# +# 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/brightbox_base' + +class Chef + class Knife + class BrightboxZoneList < Knife + + include Knife::BrightboxBase + + banner "knife brightbox zone list (options)" + + def run + zone_list = [ + ui.color('Handle (use as the --zone switch)', :bold), + ui.color('ID', :bold), + ] + connection.zones.sort_by(&:handle).each do |zone| + zone_list << zone.handle + zone_list << zone.id + end + puts ui.list(zone_list, :columns_across, 2) + end + end + end +end
Add `knife zone list` subcommand Refs #10
diff --git a/doc/ex/opacity.rb b/doc/ex/opacity.rb index abc1234..def5678 100644 --- a/doc/ex/opacity.rb +++ b/doc/ex/opacity.rb @@ -33,6 +33,5 @@ gc.text( 90,15, '"100%"') gc.draw(canvas) -canvas.matte = false -canvas.write("opacity.gif") +canvas.write("opacity.png") exit
Reset matte channel for better rendering
diff --git a/Casks/biicode.rb b/Casks/biicode.rb index abc1234..def5678 100644 --- a/Casks/biicode.rb +++ b/Casks/biicode.rb @@ -5,7 +5,7 @@ # amazonaws is the official download host per the vendor homepage url "https://s3.amazonaws.com/biibinaries/release/#{version}/bii-macos-64_#{version.gsub('.', '_')}.pkg" name 'Biicode' - homepage 'http://www.biicode.com' + homepage 'https://www.biicode.com/' license :closed pkg "bii-macos-64_#{version.gsub('.', '_')}.pkg"
Fix homepage to use SSL in Biicode Cask The HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly makes it more secure and saves a HTTP round-trip.
diff --git a/Casks/charles.rb b/Casks/charles.rb index abc1234..def5678 100644 --- a/Casks/charles.rb +++ b/Casks/charles.rb @@ -1,7 +1,7 @@ class Charles < Cask - url 'http://www.charlesproxy.com/assets/release/3.9/charles-proxy-3.9-applejava.dmg' + url 'http://www.charlesproxy.com/assets/release/3.9.1/charles-proxy-3.9.1-applejava.dmg' homepage 'http://www.charlesproxy.com/' - version '3.9' - sha256 'a5d8c557fc97ed87dbf844cb1cf0d771c7a7d342c7c730cc22032995aa912d37' + version '3.9.1' + sha256 '0d85d3d589588a40dc45f337679b742670a12caba1b62a146ba6d878b7adb370' link 'Charles.app' end
Update Charles to version 3.9.1
diff --git a/lib/hpcloud/commands/account/setup.rb b/lib/hpcloud/commands/account/setup.rb index abc1234..def5678 100644 --- a/lib/hpcloud/commands/account/setup.rb +++ b/lib/hpcloud/commands/account/setup.rb @@ -11,14 +11,14 @@ set up your account. Optionally you can specify your own endpoint to access, but in most cases you will want to use the default. - You can re-run this commmand to modify your settings. + You can re-run this command to modify your settings. DESC method_option 'no-validate', :type => :boolean, :default => false, :desc => "Don't verify account settings during setup" define_method "account:setup" do credentials = {} - credentials[:account_id] = ask 'Account Key:' - credentials[:secret_key] = ask 'Secret Key:' + credentials[:account_id] = ask 'Account ID:' + credentials[:secret_key] = ask 'Account Key:' credentials[:auth_uri] = ask_with_default 'API Auth Uri:', Config.settings[:default_auth_uri] unless options['no-validate']
Fix DEVEX-973: Match prompts to the labels used in the console.