diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/generators/invitational/entity/entity_generator.rb b/lib/generators/invitational/entity/entity_generator.rb index abc1234..def5678 100644 --- a/lib/generators/invitational/entity/entity_generator.rb +++ b/lib/generators/invitational/entity/entity_generator.rb @@ -3,8 +3,20 @@ class EntityGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) - argument :identity_class, type: :string, default: "User", banner: "Class name of identity model (e.g. User)" - argument :roles, type: :array, default: ["none", "user", "admin"], banner: "List of Roles" + argument :entity_class, type: :string, banner: "Class name of entity class to which users will be invited" + argument :roles, type: :array, default: ["role"], banner: "List of Valid Roles" + + def add_invitational_reference + @entity_class = entity_class.gsub(/\,/,"").camelize + @entity_model = @entity_class.underscore + @path = "app/models/#{@entity_model}.rb" + @role_list = roles.map{|role| ":" + role.gsub(/\,/,"")}.join(", ") + + content = " include Invitational::AcceptsInvitationAs\n accepts_invitation_as #{@role_list}\n " + + inject_into_class @path, @entity_class.constantize, content + end + end end end
Build the generator to setup an entity
diff --git a/config/routes.rb b/config/routes.rb index abc1234..def5678 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -14,6 +14,7 @@ end resources :ideas do get :toggle_used + get :toggle_interesting end resources :games, except: [:index] do resources :posts, only: [:new, :edit, :create, :update, :destroy] do
Add route 'toggle_interesting' to Ideas
diff --git a/congress.gemspec b/congress.gemspec index abc1234..def5678 100644 --- a/congress.gemspec +++ b/congress.gemspec @@ -6,7 +6,7 @@ gem.add_dependency 'faraday_middleware', '~> 0.7' gem.add_dependency 'hashie', '~> 2.0' gem.add_dependency 'multi_json', '~> 1.0' - gem.add_dependency 'rash', '~> 0.3' + gem.add_dependency 'rash', '~> 0.4' gem.add_development_dependency 'bundler', '~> 1.0' gem.author = "Erik Michaels-Ober" gem.description = %q{Ruby wrapper for the Real-Time Congress API. The Real-Time Congress API is a RESTful API over the artifacts of Congress, in as close to real-time as possible.}
Update rash dependency to version ~> 0.4
diff --git a/app/models/poll_option.rb b/app/models/poll_option.rb index abc1234..def5678 100644 --- a/app/models/poll_option.rb +++ b/app/models/poll_option.rb @@ -32,8 +32,10 @@ def display_name(zone: nil) if poll.dates_as_options formatted_datetime(name, zone || poll.time_zone) + elsif poll.poll_options_attributes.any? + name.humanize else - name.humanize + name end end end
Fix casing for user-generated poll options in email
diff --git a/definitions/disk-monitor.rb b/definitions/disk-monitor.rb index abc1234..def5678 100644 --- a/definitions/disk-monitor.rb +++ b/definitions/disk-monitor.rb @@ -1,35 +1,35 @@ define :disk_monitor, :template => "alert.sh.erb", :bin_path => "/usr/local/bin" do - application = Hash.new("").tap do |a| - a[:alert_level] = params[:name] - a[:app_name] = params[:app_name] - a[:environment] = params[:environment] - a[:pd_service_key] = params[:pd_service_key] - a[:hostname] = params[:hostname] || node[:hostname] - a[:alerting_threshold] = params[:alerting_threshold] || 90 - a[:user] = params[:user] || "root" - a[:group] = params[:group] || "root" - a[:template] = params[:template] - a[:cookbook] = params[:cookbook] || "disk-monitor" - a[:check_frequency] = params[:check_frequency] || 1 - a[:cron_frequency] = a[:check_frequency] == 1 ? "*" : "*/#{a[:check_frequency]}" - a[:bin_path] = params[:bin_path] - a[:bin_file] = params[:bin_file] || "disk-alert-#{a[:alert_level]}" - a[:bin] = "#{a[:bin_path]}/#{a[:bin_file]}" + options = { + :alert_level => params[:name], + :app_name => params[:app_name], + :environment => params[:environment], + :pd_service_key => params[:pd_service_key], + :hostname => (params[:hostname] || node[:hostname]), + :alerting_threshold => (params[:alerting_threshold] || 90), + :user => (params[:user] || "root"), + :group => (params[:group] || "root"), + :template => params[:template], + :cookbook => (params[:cookbook] || "disk-monitor"), + :check_frequency => (params[:check_frequency] || 1), + :bin_path => params[:bin_path] + } + options[:bin_file] = params[:bin_file] || "disk-alert-#{options[:alert_level]}" + options[:bin] = "#{options[:bin_path]}/#{a[:bin_file]}" + options[:cron_frequency] = options[:check_frequency] == 1 ? "*" : "*/#{options[:check_frequency]}" + + template options[:bin] do + source options[:template] + cookbook options[:cookbook] + user options[:user] + group options[:group] + mode 0755 + variables options end - template application[:bin] do - source application[:template] - cookbook application[:cookbook] - user application[:user] - group application[:group] - mode 0755 - variables application - end - - cron "disk-alert-#{application[:alert_level]}" do - minute application[:cron_frequency] - user application[:user] - command application[:bin] + cron "disk-alert-#{options[:alert_level]}" do + minute options[:cron_frequency] + user options[:user] + command options[:bin] end end
Stop using tap to support ruby 1.8.6
diff --git a/lib/foreigner.rb b/lib/foreigner.rb index abc1234..def5678 100644 --- a/lib/foreigner.rb +++ b/lib/foreigner.rb @@ -15,7 +15,7 @@ Base.class_eval do if %w(mysql postgresql).include? connection_pool.spec.config[:adapter].downcase - require "foreigner/connection_adapters/#{connection.adapter_name.downcase}_adapter" + require "foreigner/connection_adapters/#{connection_pool.spec.config[:adapter].downcase}_adapter" end end end
Fix when no database exists when using rake db:create
diff --git a/lib/browserid-rails.rb b/lib/browserid-rails.rb index abc1234..def5678 100644 --- a/lib/browserid-rails.rb +++ b/lib/browserid-rails.rb @@ -19,7 +19,7 @@ # config.browserid.audience should only be set in production end - initializer "browserid-rails.extend" do |app| + config.before_initialize do ActionController::Base.send :include, BrowserID::Rails::Base ActionView::Base.send :include, BrowserID::Rails::Helpers end
Change engine initializer into a before_initialize hook.
diff --git a/db/migrate/20170627024417_add_index_to_doc_method.rb b/db/migrate/20170627024417_add_index_to_doc_method.rb index abc1234..def5678 100644 --- a/db/migrate/20170627024417_add_index_to_doc_method.rb +++ b/db/migrate/20170627024417_add_index_to_doc_method.rb @@ -1,4 +1,4 @@-class AddIndexToDocMethods < ActiveRecord::Migration[5.1] +class AddIndexToDocMethod < ActiveRecord::Migration[5.1] def change add_index(:doc_methods, [:repo_id, :created_at]) end
Fix migration constant not matching filename. This was breaking bootsnap in dev, changing the constant solves the issue
diff --git a/spec/views/ballots/new.html.haml_spec.rb b/spec/views/ballots/new.html.haml_spec.rb index abc1234..def5678 100644 --- a/spec/views/ballots/new.html.haml_spec.rb +++ b/spec/views/ballots/new.html.haml_spec.rb @@ -19,6 +19,9 @@ mock_model(Nomination, :id => 32, :name => "Belinda Marsh") ] assign(:nominations, @nominations) + + @annual_general_meeting = mock_model(AnnualGeneralMeeting, :happened_on => 2.weeks.from_now) + assign(:annual_general_meeting, @annual_general_meeting) end it "renders a ranking field for each of the nominations" do
Fix ballots/new spec broken by 200bbdd63e4faf1a2fe7b2bfc8136ce340efd2d.
diff --git a/lib/global_id_utils.rb b/lib/global_id_utils.rb index abc1234..def5678 100644 --- a/lib/global_id_utils.rb +++ b/lib/global_id_utils.rb @@ -14,7 +14,7 @@ # the model within it. Otherwise, find the model normally. def self.locate(gid, _options = {}) if (gid = GlobalID.parse(gid)) - return super if gid.app.to_s == GlobalID.app.to_s + return gid.model_name.classify.constantize.find(gid.model_id) if gid.app.to_s == GlobalID.app.to_s "#{gid.app.classify}::#{gid.model_name}".constantize.find(gid.model_id) end end
Remove call to super class method
diff --git a/lib/halogen/railtie.rb b/lib/halogen/railtie.rb index abc1234..def5678 100644 --- a/lib/halogen/railtie.rb +++ b/lib/halogen/railtie.rb @@ -16,7 +16,7 @@ config.after_initialize do if Halogen.enabled result = Coverage.result(:retain => true) - Halogen.dispatch(result) + Halogen.dispatch(result, 0) end end end
Add run count for initial load cover.
diff --git a/lib/kmc/package_dsl.rb b/lib/kmc/package_dsl.rb index abc1234..def5678 100644 --- a/lib/kmc/package_dsl.rb +++ b/lib/kmc/package_dsl.rb @@ -3,7 +3,6 @@ def merge_directory(from, opts = {}) destination = opts[:into] || '.' - FileUtils.mkdir_p(File.dirname(File.join(self.class.ksp_path, destination))) FileUtils.cp_r(File.join(self.class.download_dir, from), File.join(self.class.ksp_path, destination)) end
Revert "Ensure there is something to copy the origin to"
diff --git a/lib/json/jose.rb b/lib/json/jose.rb index abc1234..def5678 100644 --- a/lib/json/jose.rb +++ b/lib/json/jose.rb @@ -51,7 +51,7 @@ else decode_compact_serialized input, key_or_secret, algorithms, encryption_methods end - rescue JSON::ParserError + rescue JSON::ParserError, ArgumentError raise JWT::InvalidFormat.new("Invalid JSON Format") end end
Fix 'JSON::JWT.decode when JSON parse failed should raise JSON::JWT::InvalidFormat' spec
diff --git a/lib/mercenary.rb b/lib/mercenary.rb index abc1234..def5678 100644 --- a/lib/mercenary.rb +++ b/lib/mercenary.rb @@ -1,14 +1,12 @@-lib = File.expand_path('../', __FILE__) - -require "#{lib}/mercenary/version" +require File.expand_path("../mercenary/version", __FILE__) require "optparse" require "logger" module Mercenary - autoload :Command, "#{lib}/mercenary/command" - autoload :Option, "#{lib}/mercenary/option" - autoload :Presenter, "#{lib}/mercenary/presenter" - autoload :Program, "#{lib}/mercenary/program" + autoload :Command, File.expand_path("../mercenary/command", __FILE__) + autoload :Option, File.expand_path("../mercenary/option", __FILE__) + autoload :Presenter, File.expand_path("../mercenary/presenter", __FILE__) + autoload :Program, File.expand_path("../mercenary/program", __FILE__) # Public: Instantiate a new program and execute. #
Use File.expand_path to build paths.
diff --git a/lib/metric_fu.rb b/lib/metric_fu.rb index abc1234..def5678 100644 --- a/lib/metric_fu.rb +++ b/lib/metric_fu.rb @@ -2,16 +2,19 @@ module MetricFu APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__),'..')) LIB_ROOT = File.join(APP_ROOT,'lib/metric_fu') - def self.root_dir + + module_function + + def root_dir APP_ROOT end - def self.lib_dir + def lib_dir LIB_ROOT end require 'metric_fu/loader' LOADER = MetricFu::Loader.new(LIB_ROOT) - def self.lib_require(base='',&block) + def lib_require(base='',&block) LOADER.lib_require(base,&block) end @@ -20,9 +23,9 @@ end # @note artifact_dir is relative to where the task is being run, - # not to the metric_fu library + # not to the metric_fu library require 'metric_fu/io' - def self.artifact_dir + def artifact_dir MetricFu::Io::FileSystem.artifact_dir end @@ -30,13 +33,13 @@ %w(scratch output _data) end - def self.tasks_load(tasks_relative_path) + def tasks_load(tasks_relative_path) LOADER.load_tasks(tasks_relative_path) end LOADER.setup - def self.reset + def reset # TODO Don't like how this method needs to know # all of these class variables that are defined # in separate classes.
Make MetricFu base module use module_function for simplicity
diff --git a/hash_selectors.gemspec b/hash_selectors.gemspec index abc1234..def5678 100644 --- a/hash_selectors.gemspec +++ b/hash_selectors.gemspec @@ -2,7 +2,7 @@ spec = Gem::Specification.new do |s| s.name = "hash_selectors" - s.version = "0.0.2" + s.version = "0.0.3" s.summary = "Some select methods for Ruby Hashes" s.description = "Provides additional select-type methods for Ruby Hashes" s.authors = ["Kevin C. Baird"]
Increment version 0.0.2 -> 0.0.3: Add ...values_for_keys methods
diff --git a/gemdiff.gemspec b/gemdiff.gemspec index abc1234..def5678 100644 --- a/gemdiff.gemspec +++ b/gemdiff.gemspec @@ -25,5 +25,5 @@ spec.add_development_dependency "minitest", "~> 5.4" spec.add_development_dependency "mocha", "~> 1.1" - spec.add_development_dependency "rake", "~> 12.0" + spec.add_development_dependency "rake", "~> 13.0" end
Use rake 13 in development
diff --git a/jekyll-compass.gemspec b/jekyll-compass.gemspec index abc1234..def5678 100644 --- a/jekyll-compass.gemspec +++ b/jekyll-compass.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.name = 'jekyll-compass' - s.version = '0.2-dev' + s.version = '0.2.dev' s.summary = "Jekyll generator plugin to build Compass projects during site build" s.description = <<-EOF This project is a plugin for the Jekyll static website generator to allow for using Compass projects with your
Fix version number to something valid to rubygems
diff --git a/contentful_client.gemspec b/contentful_client.gemspec index abc1234..def5678 100644 --- a/contentful_client.gemspec +++ b/contentful_client.gemspec @@ -8,9 +8,9 @@ spec.version = Contentful::VERSION spec.authors = ['Mateusz Sójka'] spec.email = ['yagooar@gmail.com'] - spec.description = %q{contentful_client allows to communicate with the Contentful API in a simple and clean way.} + spec.description = %q{contentful_client allows to use Ruby to communicate with the Contentful API in a simple and clean way.} - spec.summary = %q{A tiny wrapper around the Contentful API.} + spec.summary = %q{A tiny Ruby wrapper around the Contentful API.} spec.homepage = '' spec.license = 'MIT'
Make clear it's a ruby client
diff --git a/lib/resync/resource.rb b/lib/resync/resource.rb index abc1234..def5678 100644 --- a/lib/resync/resource.rb +++ b/lib/resync/resource.rb @@ -44,6 +44,16 @@ end # ------------------------------------------------------------ + # Overrides + + # ResourceSync schema requires '##other' elements to appear last + def self.all_xml_mapping_nodes(options={:mapping=>nil,:create=>true}) + result = [] + result += xml_mapping_nodes options + result += superclass.all_xml_mapping_nodes options + end + + # ------------------------------------------------------------ # Private methods private
Make sure rs:ln and rs:md appear last
diff --git a/lib/shared_mustache.rb b/lib/shared_mustache.rb index abc1234..def5678 100644 --- a/lib/shared_mustache.rb +++ b/lib/shared_mustache.rb @@ -9,7 +9,7 @@ end def self.file_list - Dir[File.join(view_dir, '**', '*.mustache')] + Dir[File.join(view_dir, '**', '*.mustache')].sort end def self.file_name_to_id(filename)
Sort the file list so it is in a reliable order So that the compile file is reliably the same no matter where or when it is run.
diff --git a/lib/sequent/core/helpers/date_time_validator.rb b/lib/sequent/core/helpers/date_time_validator.rb index abc1234..def5678 100644 --- a/lib/sequent/core/helpers/date_time_validator.rb +++ b/lib/sequent/core/helpers/date_time_validator.rb @@ -10,11 +10,9 @@ class DateTimeValidator < ActiveModel::EachValidator def validate_each(subject, attribute, value) return if value.is_a?(DateTime) - begin - DateTime.deserialize_from_json(value) - rescue - subject.errors.add attribute, :invalid_date_time - end + DateTime.deserialize_from_json(value) + rescue + subject.errors.add attribute, :invalid_date_time end end end
Refactor to remove begin in begin/rescue block
diff --git a/core/lib/spree/testing_support/factories/stock_location_factory.rb b/core/lib/spree/testing_support/factories/stock_location_factory.rb index abc1234..def5678 100644 --- a/core/lib/spree/testing_support/factories/stock_location_factory.rb +++ b/core/lib/spree/testing_support/factories/stock_location_factory.rb @@ -7,8 +7,8 @@ phone '(202) 456-1111' active true - state { |stock_location| stock_location.association(:state) } country { |stock_location| stock_location.association(:country) } + state { |stock_location| stock_location.association(:state, :country => stock_location.country) } factory :stock_location_with_items do after(:create) do |stock_location, evaluator|
Use stock_location's country for stock_location's state in stock_location factory This is so that it doesn't create a new country and associate the state with that.
diff --git a/lib/crocoduck/entry.rb b/lib/crocoduck/entry.rb index abc1234..def5678 100644 --- a/lib/crocoduck/entry.rb +++ b/lib/crocoduck/entry.rb @@ -5,32 +5,14 @@ require 'crocoduck/store' module Crocoduck - class Entry - def self.keys - Redis.keys "entries:*" + class Entry + attr_accessor :entry_id, :entry + + def initialize(entry_id) + @entry_id = entry_id end - - def self.find(entry_id) - if json = Redis.get("entries:#{entry_id}") - new JSON.parse(json) - end - end - - attr_accessor :entry_id, :entry, :store_cluster, - :store_db_name, :store_collection, - def initialize(attributes = {}) - attributes.each do |key, value| - self.send "#{key}=", value - end - end - - def save - Redis.set "entries:#{entry_id}", to_json - end - - def schedule(worker) - worker ||= Job + def schedule(worker = Job) Resque.enqueue worker, entry_id end @@ -38,27 +20,12 @@ @entry ||= store.get entry_id end - def attributes - { - 'entry_id' => entry_id, - 'store_cluster' => store_cluster, - 'store_db_name' => store_db_name, - 'store_collection' => store_collection, - } - end - - def to_json(*args) - attributes.to_json(*args) - end - - def setup? - entry_id && - store_cluster && store_db_name && store_collection + def update(field, value) + store.update entry_id, field, value end def store - return unless store_cluster && store_db_name && store_collection - Store.new store_cluster, store_db_name, store_collection + Store.new end end end
Stop all this redis stuff. Don't need it. Entry and its data is "authoritatively" stored in Mongo, lets use it.
diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb index abc1234..def5678 100644 --- a/spec/models/post_spec.rb +++ b/spec/models/post_spec.rb @@ -1,4 +1,20 @@ require 'spec_helper' describe Post do + describe 'create' do + before do + Post.create( + title: 'EXCELLENT!', + body: "You're excellent player!" + ) + @post = Post.last + end + subject { @post } + context 'created successfully' do + it 'has correct attributes' do + expect(subject.title).to eq 'EXCELLENT!' + expect(subject.body).to eq "You're excellent player!" + end + end + end end
Add specs for Post model.
diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index abc1234..def5678 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -4,9 +4,27 @@ Capybara.configure do |config| config.ignore_hidden_elements = true + Capybara.default_driver = :webkit config.javascript_driver = :webkit end Capybara::Webkit.configure do |config| config.block_unknown_urls + config.allow_url("lvh.me") end + +RSpec.configure do |config| + config.before(:suite) do + Capybara.always_include_port = true + # The default is to treat each spec as single tennat, in which case + # we want to hit localhost. Hitting the Capbyara default of www.example.com + # causes the apartment setup to try and parse the `www` as a subdomain + Capybara.app_host = "http://localhost" + end + + config.before(:each, multi_tenant: true) do + # For multi-tenant specs, use "lvh.me", although this will often be + # overridden with thelp of the `with_subdomain` helper + Capybara.app_host = "http://lvh.me" + end +end
Configure Capybara to support single and multi tenant feature specs
diff --git a/Casks/phpstorm-bundled-jdk.rb b/Casks/phpstorm-bundled-jdk.rb index abc1234..def5678 100644 --- a/Casks/phpstorm-bundled-jdk.rb +++ b/Casks/phpstorm-bundled-jdk.rb @@ -0,0 +1,17 @@+cask :v1 => 'phpstorm-bundled-jdk' do + version '9.0.1' + sha256 '274f050445971108e503655cad01d407ee24b078a9a8d7075bd260bea4c3eb35' + + url 'http://download-cf.jetbrains.com/webide/PhpStorm-#{version}-custom-jdk-bundled.dmg' + name 'PhpStorm' + homepage 'https://www.jetbrains.com/phpstorm/' + license :commercial + + app 'PhpStorm.app' + + zap :delete => [ + '~/Library/Application Support/WebIde90', + '~/Library/Preferences/WebIde90', + '~/Library/Preferences/com.jetbrains.PhpStorm.plist', + ] +end
Add PHPStorm with bundled JDK
diff --git a/spec/unit/spec_helper.rb b/spec/unit/spec_helper.rb index abc1234..def5678 100644 --- a/spec/unit/spec_helper.rb +++ b/spec/unit/spec_helper.rb @@ -4,9 +4,7 @@ RSpec.configure do |config| config.platform = 'mac_os_x' - config.version = '10.8.2' # FIXME: system ruby and fauxhai don't play nice - # since there is no 10.9.2.json file yet. We - # should submit a PR to fauxhai to fix this + config.version = '10.11.1' # via https://github.com/customink/fauxhai/tree/master/lib/fauxhai/platforms/mac_os_x config.before { stub_const('ENV', 'SUDO_USER' => 'fauxhai') } config.after(:suite) { FileUtils.rm_r('.librarian') } end
Use Fauxhai platform version 10.11.1 instead of 10.8.2
diff --git a/garager.gemspec b/garager.gemspec index abc1234..def5678 100644 --- a/garager.gemspec +++ b/garager.gemspec @@ -16,8 +16,6 @@ s.files = %w( Gemfile README.md LICENSE.txt garager.gemspec ) s.files += Dir.glob("lib/**/*") s.files += Dir.glob("bin/*") - s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) } - # s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = ["lib"] s.add_development_dependency "bundler", "~> 1.7"
Remove executables. Install interference fix
diff --git a/app/importers/file_importers/educators_importer.rb b/app/importers/file_importers/educators_importer.rb index abc1234..def5678 100644 --- a/app/importers/file_importers/educators_importer.rb +++ b/app/importers/file_importers/educators_importer.rb @@ -21,7 +21,6 @@ if educator.present? educator.save! - educator.save_student_searchbar_json homeroom = Homeroom.find_by_name(row[:homeroom]) if row[:homeroom] homeroom.update(educator: educator) if homeroom.present?
Remove student searchbar caching from educator import job + Good catch from @jhilde: this isn't needed on every import since all the main educator users of the platform have had this data precomputed for them with a background job. + https://github.com/studentinsights/studentinsights/issues/993#issuecomment-329496753
diff --git a/roger.gemspec b/roger.gemspec index abc1234..def5678 100644 --- a/roger.gemspec +++ b/roger.gemspec @@ -0,0 +1,29 @@+# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = "roger" + s.version = "0.0.1" + + s.authors = ["Flurin Egger", "Edwin van der Graaf", "Joran Kapteijns"] + s.email = ["info@digitpaint.nl", "flurin@digitpaint.nl"] + s.homepage = "http://github.com/digitpaint/html_mockup" + s.summary = "Roger is a set of tools to create self-containing HTML mockups." + s.licenses = ["MIT"] + + s.date = Time.now.strftime("%Y-%m-%d") + + s.files = [] + s.test_files = [] + s.executables = [] + s.require_paths = ["lib"] + + s.extra_rdoc_files = [ + "README.md" + ] + + s.rdoc_options = ["--charset=UTF-8"] + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + + s.add_dependency("html_mockup", ["~> 0.8.4"]) +end
Add the gemspec for the new name
diff --git a/roles/nchc.rb b/roles/nchc.rb index abc1234..def5678 100644 --- a/roles/nchc.rb +++ b/roles/nchc.rb @@ -2,6 +2,12 @@ description "Role applied to all servers at NCHC" default_attributes( + :accounts => { + :users => { + :steven => { :status => :administrator }, + :ceasar => { :status => :administrator } + } + }, :networking => { :nameservers => [ "8.8.8.8", "8.8.4.4" ], :roles => {
Add local admin accounts for NCHC machines
diff --git a/git_wit.gemspec b/git_wit.gemspec index abc1234..def5678 100644 --- a/git_wit.gemspec +++ b/git_wit.gemspec @@ -10,7 +10,7 @@ s.homepage = "https://github.com/xdissent/git_wit" s.description = s.summary = "Dead simple Git hosting for Rails apps." - s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] + s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.md"] s.test_files = Dir["test/**/*"] s.executables << "gw-shell"
Update gemspec for new readme.
diff --git a/lib/route_validator.rb b/lib/route_validator.rb index abc1234..def5678 100644 --- a/lib/route_validator.rb +++ b/lib/route_validator.rb @@ -12,7 +12,7 @@ valid = route[:controller] == 'duckrails/mocks' && route[:action] == 'serve_mock' && route[:duckrails_mock_id] == record.id rescue URI::InvalidURIError => exception # Bad URI - record.errors[attribute] << (options[:message] || "is not a valid route") + record.errors[attribute] << (options[:message] || 'is not a valid route') rescue ActionController::RoutingError => exception # FIXME: check if this exception is raised in other cases except when the route doesn't exist # Route doesn't exist, you may proceed
Fix unused interpolation in mock route validator.
diff --git a/CrashlyticsLumberjack.podspec b/CrashlyticsLumberjack.podspec index abc1234..def5678 100644 --- a/CrashlyticsLumberjack.podspec +++ b/CrashlyticsLumberjack.podspec @@ -10,14 +10,11 @@ s.source_files = 'Source', 'Source/CrashlyticsLogger.{h,m}' s.requires_arc = true - s.osx.deployment_target = '10.7' - s.ios.deployment_target = '5.0' + s.osx.deployment_target = '10.8' + s.ios.deployment_target = '8.0' s.dependency 'CocoaLumberjack/Default', '~> 2.0.0' - - s.subspec 'Framework' do |sp| - sp.platform = :ios, '8.0' - sp.dependency 'CrashlyticsFramework', '~> 2.2' - end + s.ios.dependency 'Crashlytics' + s.osx.dependency 'Crashlytics-OSX' end
Fix podspec to depend on official crashlytics
diff --git a/osrshighscores.gemspec b/osrshighscores.gemspec index abc1234..def5678 100644 --- a/osrshighscores.gemspec +++ b/osrshighscores.gemspec @@ -1,4 +1,4 @@-# coding: utf-8 +# encoding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'osrshighscores/version'
Fix tiny typo in encoding declaration
diff --git a/spec/controllers/ansible_repository_controller_spec.rb b/spec/controllers/ansible_repository_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/ansible_repository_controller_spec.rb +++ b/spec/controllers/ansible_repository_controller_spec.rb @@ -14,6 +14,7 @@ it "return correct http response code" do is_expected.to have_http_status 200 end + it "render view for specific repostitory" do is_expected.to render_template(:partial => "layouts/_textual_groups_generic") end @@ -27,6 +28,7 @@ it "return correct http response code" do is_expected.to have_http_status 200 end + it "render view for list of repositories" do is_expected.to render_template(:partial => "layouts/_gtl") end
Add missing empty lines between test cases
diff --git a/app/controllers/authors_controller.rb b/app/controllers/authors_controller.rb index abc1234..def5678 100644 --- a/app/controllers/authors_controller.rb +++ b/app/controllers/authors_controller.rb @@ -1,5 +1,5 @@ class AuthorsController < ApplicationController def index - ['casey', 'kelly'] + ['casey', 'kelly', 'fudge', 'other', 'seasaw', 'goat'] end end
Add more items to authors test array.
diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb index abc1234..def5678 100644 --- a/app/controllers/content_controller.rb +++ b/app/controllers/content_controller.rb @@ -25,8 +25,8 @@ # TODO: Make this work for all content. def auto_discovery_feed(options = { }) with_options(options.reverse_merge(:only_path => true)) do |opts| - @auto_discovery_url_rss = opts.url_for(:format => 'rss') - @auto_discovery_url_atom = opts.url_for(:format => 'atom') + @auto_discovery_url_rss = opts.url_for(:format => 'rss', :only_path => false) + @auto_discovery_url_atom = opts.url_for(:format => 'atom', :only_path => false) end end
Make sure feed discovery url includes host name.
diff --git a/spec/integration/release/create_bosh_release_spec.rb b/spec/integration/release/create_bosh_release_spec.rb index abc1234..def5678 100644 --- a/spec/integration/release/create_bosh_release_spec.rb +++ b/spec/integration/release/create_bosh_release_spec.rb @@ -2,18 +2,20 @@ describe 'create bosh release', type: :integration do it 'creates a bosh dev release successfully' do - bosh_source_path = ENV['PWD'] - test_dir = Dir.mktmpdir("bosh-release-test") - bosh_folder_name = bosh_source_path.split('/').last - err = nil - Bundler.with_clean_env do - create_dev_release = "bundle exec rake release:create_dev_release --trace" - _, _, err = Open3.capture3("pushd #{test_dir} && git clone #{bosh_source_path} && cd #{bosh_folder_name} && #{create_dev_release}") + bosh_source_path = File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', '..') + Dir.mktmpdir('bosh-release-test') do |test_dir| + cloned_bosh_dir = File.join(test_dir, 'cloned-bosh') + + _, _, exit_status = Open3.capture3("git clone --depth 1 #{bosh_source_path} #{cloned_bosh_dir}") + expect(exit_status).to be_success + + Bundler.with_clean_env do + create_dev_release_cmd = 'bundle exec rake release:create_dev_release --trace' + stdout, _, exit_status = Open3.capture3(create_dev_release_cmd, chdir: cloned_bosh_dir) + expect(exit_status).to be_success + + expect(stdout).to include('Release name: bosh') + end end - - release_folder = Dir.new("#{test_dir}/#{bosh_folder_name}/release/dev_releases/bosh") - - expect(release_folder.entries.any? {|file| file.match(/.*dev.*.yml/)}).to eq(true) - expect(err.success?).to eq(true) end end
Refactor create bosh release test Signed-off-by: Maria Shaldibina <dc03896a0185453e5852a5e0f0fab6cbd2e026ff@pivotal.io>
diff --git a/spec/overcommit/hook/pre_commit/bundle_check_spec.rb b/spec/overcommit/hook/pre_commit/bundle_check_spec.rb index abc1234..def5678 100644 --- a/spec/overcommit/hook/pre_commit/bundle_check_spec.rb +++ b/spec/overcommit/hook/pre_commit/bundle_check_spec.rb @@ -13,45 +13,51 @@ it { should warn } end - context 'when Gemfile.lock is ignored' do - around do |example| - repo do - `touch Gemfile.lock` - `echo Gemfile.lock > .gitignore` - `git add .gitignore` - `git commit -m "Ignore Gemfile.lock"` - example.run - end + context 'when bundler is installed' do + before do + subject.stub(:in_path?).and_return(true) end - it { should pass } - end - - context 'when Gemfile.lock is not ignored' do - let(:result) { double('result') } - - around do |example| - repo do - example.run + context 'when Gemfile.lock is ignored' do + around do |example| + repo do + `touch Gemfile.lock` + `echo Gemfile.lock > .gitignore` + `git add .gitignore` + `git commit -m "Ignore Gemfile.lock"` + example.run + end end - end - - before do - result.stub(:success? => success, :stdout => 'Bundler error message') - subject.stub(:execute).and_call_original - subject.stub(:execute).with(%w[bundle check]).and_return(result) - end - - context 'and bundle check exits unsuccessfully' do - let(:success) { false } - - it { should fail_hook } - end - - context 'and bundle check exist successfully' do - let(:success) { true } it { should pass } end + + context 'when Gemfile.lock is not ignored' do + let(:result) { double('result') } + + around do |example| + repo do + example.run + end + end + + before do + result.stub(:success? => success, :stdout => 'Bundler error message') + subject.stub(:execute).and_call_original + subject.stub(:execute).with(%w[bundle check]).and_return(result) + end + + context 'and bundle check exits unsuccessfully' do + let(:success) { false } + + it { should fail_hook } + end + + context 'and bundle check exist successfully' do + let(:success) { true } + + it { should pass } + end + end end end
Fix BundleCheck spec to stub in_path? This spec didn't stub the call to `in_path?` when it should have. It worked because `bundler` is installed on Travis, but it is better form to not make that assumption. Change-Id: Ie974f5e22f55c3ab977c69f232e8667a4b34460c Reviewed-on: http://gerrit.causes.com/37941 Tested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com> Reviewed-by: Shane da Silva <6f6e68d1df92f30cb4b3ce35260ddf94a402f33d@causes.com>
diff --git a/lib/kracken/railtie.rb b/lib/kracken/railtie.rb index abc1234..def5678 100644 --- a/lib/kracken/railtie.rb +++ b/lib/kracken/railtie.rb @@ -7,5 +7,27 @@ app.middleware.insert_after ActionDispatch::DebugExceptions, ::Kracken::JsonApi::PublicExceptions end + + config.before_initialize do |app| + app.config.filter_parameters += %i[ + code + email + linked_accounts + raw_info + redirect_to + redirect_uri + state + token + ] + app.config.filter_redirect += [ + "auth/radius", + "auth/token", + ] + end + + # Allow apps to configure the provider in initializers + config.after_initialize do |app| + app.config.filter_redirect << URI(Kracken.config.provider_url).host + end end end
Add Rails filters to remove more sensitive fields This focuses on removing sensitive parameter fields related to users and authentication. We exclude specific fields in the auth hash, in case apps use them elsewhere, as well as the entire raw auth hash. Additionally, this excludes parameters use specifically in the OAuth flow redirects. This also filters redirects to external system auth endpoints as these can contain sensitive code and state data. Similarly, anything related to the configured provider account system is removed as well to avoid leaking more information. See: - http://guides.rubyonrails.org/v5.1.6/action_controller_overview.html#log-filtering - https://github.com/rails/rails/blob/v5.1.6/actionpack/lib/action_dispatch/http/filter_parameters.rb - https://github.com/rails/rails/blob/v5.1.6/actionpack/lib/action_dispatch/http/filter_redirect.rb
diff --git a/lib/paginated_array.rb b/lib/paginated_array.rb index abc1234..def5678 100644 --- a/lib/paginated_array.rb +++ b/lib/paginated_array.rb @@ -1,8 +1,10 @@ class PaginatedArray < Array - attr_reader(:total_count) - def initialize(values, total_count) + attr_reader(:total_count, :page, :per_page) + def initialize(values, total_count, page = 1, per_page = 25) super(values) @total_count = total_count + @page = page + @per_page = per_page end def self.sort_and_paginate_count_hash(count_hash, page: 1, per_page: nil) @@ -18,4 +20,16 @@ hash[:count] }.reverse.slice(start_index..end_index) end + + def total_pages + @total_count / @per_page + end + + def current_page + page + end + + def limit_value + per_page + end end
Update PaginatedArray that conforms Kaminari::PaginatableArray
diff --git a/test/test_time_manager.rb b/test/test_time_manager.rb index abc1234..def5678 100644 --- a/test/test_time_manager.rb +++ b/test/test_time_manager.rb @@ -1,6 +1,7 @@ require 'minitest/autorun' require 'minitest/reporters' require "mastermind/oscar/time_manager" +require "time" class TimeManagerTest < Minitest::Test def setup @@ -19,11 +20,24 @@ def test_evaluate x = 18290, 290 - y = 3600, 60 + y = 3600, 60 ans = [5, 290], [4, 50] x.each_index do |i| assert_equal(ans[i], @client.evaluate(x[i], y[i])) end end + + def test_to_string + input = [[1, 'hour'],[5, 'minute'],[0, 'second'],[1, 'second'],[6, 'hour']] + expect = ['1 hour ', '5 minutes ', nil, '1 second ', '6 hours '] + + input.each_index do |i| + time = input[i][0] + unit = input[i][1] + assert_equal(expect[i], @client.to_string(time, unit)) + end + end + + end
Add test for getting and evaluation gameplay time
diff --git a/lib/stickler/client.rb b/lib/stickler/client.rb index abc1234..def5678 100644 --- a/lib/stickler/client.rb +++ b/lib/stickler/client.rb @@ -30,7 +30,6 @@ def parse( argv ) opts = Trollop::with_standard_exception_handling( parser ) do - raise Trollop::HelpNeeded if argv.empty? # show help screen o = parser.parse( argv ) yield parser if block_given? return o
Allow the 'list' command to work with no flags.
diff --git a/config/initializers/forbidden_yaml.rb b/config/initializers/forbidden_yaml.rb index abc1234..def5678 100644 --- a/config/initializers/forbidden_yaml.rb +++ b/config/initializers/forbidden_yaml.rb @@ -0,0 +1,59 @@+# XXX: This is purely a monkey patch to close the exploit vector for now, a more +# permanent solution should be pushed upstream into rubygems. + +require "rubygems" + +# Assert we're using Psych +abort "Use Psych for YAML, install libyaml and reinstall ruby" unless YAML == Psych + +module Psych + class ForbiddenClassException < Exception + end + + module Visitors + class WhitelistedToRuby < ToRuby + WHITELIST = %w( + Gem::Dependency + Gem::Platform + Gem::Requirement + Gem::Specification + Gem::Version + Gem::Version::Requirement + ) + + private + + def resolve_class klassname + raise ForbiddenClassException, "Forbidden class in YAML: #{klassname}" unless WHITELIST.include? klassname + super klassname + end + end + end +end + +module Gem + class Specification + def self.from_yaml input + input = normalize_yaml_input input + nodes = Psych.parse input + spec = Psych::Visitors::WhitelistedToRuby.new.accept nodes + + if spec && spec.class == FalseClass then + raise Gem::EndOfYAMLException + end + + unless Gem::Specification === spec then + raise Gem::Exception, "YAML data doesn't evaluate to gem specification" + end + + unless (spec.instance_variables.include? '@specification_version' or + spec.instance_variables.include? :@specification_version) and + spec.instance_variable_get :@specification_version + spec.instance_variable_set :@specification_version, + NONEXISTENT_SPECIFICATION_VERSION + end + + spec + end + end +end
Patch YAML to allow only some Gem classes to be unmarshalled
diff --git a/snooper.gemspec b/snooper.gemspec index abc1234..def5678 100644 --- a/snooper.gemspec +++ b/snooper.gemspec @@ -1,6 +1,8 @@ $:.unshift File.expand_path('../lib/', __FILE__) require 'snooper/version' +require 'rbconfig' +HOST_OS ||= RbConfig::CONFIG['target_os'] Gem::Specification.new do |s| s.name = 'snooper' @@ -24,6 +26,10 @@ # Gem dependencies s.add_runtime_dependency "colored", [">= 1.2"] s.add_runtime_dependency "listen", ["~> 2.7"] - s.add_runtime_dependency "ruby-terminfo", [">= 0.1"] + if HOST_OS =~ /mswin|mingw|cygwin/i + s.add_runtime_dependency "wdm", ">= 0.1.0" + else + s.add_runtime_dependency "ruby-terminfo", [">= 0.1"] + end s.add_development_dependency "ronn", [">= 0.7.3"] end
Update Gemspec to Recognise Windows If we're on windows we need to get the WDM module. WE can't have the Terminfo module either. Still need to update snoop to recognise this.
diff --git a/brew-cask-upgrade.gemspec b/brew-cask-upgrade.gemspec index abc1234..def5678 100644 --- a/brew-cask-upgrade.gemspec +++ b/brew-cask-upgrade.gemspec @@ -1,7 +1,6 @@ Gem::Specification.new do |s| s.name = "brew-cask-upgrade" s.version = "0.1.1" - s.date = "2015-11-06" s.summary = "A command line tool for Homebrew Cask" s.description = "A command line tool for upgrading every outdated apps installed by Homebrew Cask" s.authors = ["buo"]
Remove date field from gemspec
diff --git a/evtx.gemspec b/evtx.gemspec index abc1234..def5678 100644 --- a/evtx.gemspec +++ b/evtx.gemspec @@ -20,13 +20,13 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ['lib'] - spec.add_dependency 'bindata', '~> 2.3.0' + spec.add_dependency 'bindata', '~> 2.3.0' # Development only - spec.add_development_dependency 'bundler', '~> 1.11.2' - spec.add_development_dependency 'pry', '~> 0.10.3' - spec.add_development_dependency 'rake', '~> 10.5.0' - spec.add_development_dependency 'rubocop', '~> 0.37.2' - spec.add_development_dependency 'rspec', '~> 3.4.0' - spec.add_development_dependency 'yard', '~> 0.8.7.6' + spec.add_development_dependency 'bundler' + spec.add_development_dependency 'pry' + spec.add_development_dependency 'rake' + spec.add_development_dependency 'rubocop' + spec.add_development_dependency 'rspec' + spec.add_development_dependency 'yard' end
Remove development gem dependency version pins.
diff --git a/app/jobs/process_user_job.rb b/app/jobs/process_user_job.rb index abc1234..def5678 100644 --- a/app/jobs/process_user_job.rb +++ b/app/jobs/process_user_job.rb @@ -0,0 +1,11 @@+# frozen_string_literal: true + +class ProcessUserJob < ApplicationJob + queue_as :default + + def perform(id) + u = User.find(id) + u.locked = false + u.save + end +end
Add ActiveJob that will just free existing users for worker Jobs that are in the queue currently will still retry a few times (or go to the deadset). If there's no job they will be sent straight to the dead queue. With this the existing jobs will not fail and will transition to worker without any issues.
diff --git a/app/models/educator_label.rb b/app/models/educator_label.rb index abc1234..def5678 100644 --- a/app/models/educator_label.rb +++ b/app/models/educator_label.rb @@ -6,6 +6,10 @@ validates :label_key, { presence: true, uniqueness: { scope: [:label_key, :educator] }, - inclusion: { in: ['shs_experience_team'] } + inclusion: { + in: [ + 'shs_experience_team', 'k8_counselor', 'highschool_house_master' + ] + } } end
Add educator labels for K8 counselor and housemaster to validation
diff --git a/app/models/resource_group.rb b/app/models/resource_group.rb index abc1234..def5678 100644 --- a/app/models/resource_group.rb +++ b/app/models/resource_group.rb @@ -1,4 +1,5 @@ class ResourceGroup < ApplicationRecord + acts_as_miq_taggable alias_attribute :images, :templates has_many :vm_or_templates
Make resource groups taggable concerns
diff --git a/lib/authlogic/controller_adapters/sinatra_adapter.rb b/lib/authlogic/controller_adapters/sinatra_adapter.rb index abc1234..def5678 100644 --- a/lib/authlogic/controller_adapters/sinatra_adapter.rb +++ b/lib/authlogic/controller_adapters/sinatra_adapter.rb @@ -58,4 +58,4 @@ end end -Sinatra::Request.send(:include, Authlogic::ControllerAdapters::SinatraAdapter::Adapter::Implementation)+Sinatra::Base.send(:include, Authlogic::ControllerAdapters::SinatraAdapter::Adapter::Implementation)
Fix undefined method error in Sinatra adapter.
diff --git a/app/models/competitions/concerns/overall_bar/races.rb b/app/models/competitions/concerns/overall_bar/races.rb index abc1234..def5678 100644 --- a/app/models/competitions/concerns/overall_bar/races.rb +++ b/app/models/competitions/concerns/overall_bar/races.rb @@ -10,9 +10,11 @@ event = children.detect { |e| e.discipline == discipline.name } end - if event - event.races.detect { |e| e.category == category } - end + ::Race. + where(:event_id => event.id). + where(:category_id => category.id). + includes(:results). + first end def create_races
Use finder to eager-load results
diff --git a/features/step_definitions/rails_steps.rb b/features/step_definitions/rails_steps.rb index abc1234..def5678 100644 --- a/features/step_definitions/rails_steps.rb +++ b/features/step_definitions/rails_steps.rb @@ -1,8 +1,16 @@ Given /^a pristine Rails application$/ do @aruba_timeout_seconds = 20 + app_name = 'test_app' + cache_name = 'cached_test_app' + cache_path = File.join('tmp', cache_name) + target_dir = File.join('tmp', 'aruba') - run_simple 'bundle exec rails new test_app --skip-test-unit' - assert_passing_with('README') + # create cached rails app if missing + unless File.directory?(cache_path) + command = 'cd tmp; bundle exec rails new #{cache_name} --skip-test-unit' + system(command) or raise "Rails app generation failed" + end - cd 'test_app' + FileUtils.cp_r cache_path, File.join(target_dir, app_name) + cd app_name end
Improve Rails app generation step (speedup)
diff --git a/site-cookbooks/media-server/recipes/plex.rb b/site-cookbooks/media-server/recipes/plex.rb index abc1234..def5678 100644 --- a/site-cookbooks/media-server/recipes/plex.rb +++ b/site-cookbooks/media-server/recipes/plex.rb @@ -36,11 +36,15 @@ ] devices [ { - "PathOnHost"=>"/dev/dri", - "PathInContainer"=>"/dev/dri", + "PathOnHost"=>"/dev/dri/card0", + "PathInContainer"=>"/dev/dri/card0", + "CgroupPermissions"=>"mrw" + }, + { + "PathOnHost"=>"/dev/dri/renderD128", + "PathInContainer"=>"/dev/dri/renderD128", "CgroupPermissions"=>"mrw" } ] - privileged true restart_policy 'always' end
Remove priviledged status from Plex
diff --git a/disqus_rails.gemspec b/disqus_rails.gemspec index abc1234..def5678 100644 --- a/disqus_rails.gemspec +++ b/disqus_rails.gemspec @@ -10,8 +10,8 @@ s.authors = ['Thach Chau'] s.email = ['rog.kane@gmail.com'] s.homepage = 'http://github.com/chautoni' - s.summary = 'Summary of DisqusRails.' - s.description = 'Description of DisqusRails.' + s.summary = 'Asynchronous integration Disqus with your Rails application' + s.description = 'This gem provide a simple solution to setup/integrate Disqus discussion platform into your Rails application' s.files = Dir['{app,config,db,lib}/**/*'] + ['MIT-LICENSE', 'Rakefile', 'README.rdoc']
Update summary and description in gemspec
diff --git a/recipes/default.rb b/recipes/default.rb index abc1234..def5678 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -24,6 +24,7 @@ file '/etc/X11/xorg.conf.d/20-nvidia.conf' do action :delete end + package 'xserver-xorg' end # Software.
Install Xorg on non-nvidia systems.
diff --git a/lib/enum_set.rb b/lib/enum_set.rb index abc1234..def5678 100644 --- a/lib/enum_set.rb +++ b/lib/enum_set.rb @@ -11,7 +11,9 @@ def enum_set(enums) enums.each do |column, names| names.map!(&:to_sym) - names_with_bits = names.each_with_index.map { |name, i| [name, 1 << i] } + names_with_bits = Hash[ + names.each_with_index.map { |name, i| [name, 1 << i] } + ] define_method :"#{column}_bitfield" do self[column] || 0 @@ -30,15 +32,14 @@ define_method :"#{column}=" do |values| case values when Array - new_value = send("#{column}_bitfield") - values.each do |val| raise EnumError.new("Unrecognized value for #{column}: #{val.inspect}") unless names.include?(val) end - values.each do |val| - bit = names_with_bits.find { |name,_| name == val.to_sym }.last - new_value |= bit + current_value = send("#{column}_bitfield") + + new_value = values.reduce(current_value) do |acc, val| + acc | names_with_bits[val.to_sym] end when Fixnum new_value = values
Use clearer(?) `reduce` block for setter
diff --git a/lib/exercism.rb b/lib/exercism.rb index abc1234..def5678 100644 --- a/lib/exercism.rb +++ b/lib/exercism.rb @@ -12,7 +12,11 @@ class Exercism def self.home - Dir.home(Etc.getlogin) + if ENV["OS"] == 'Windows_NT' then + ENV["HOMEDRIVE"]+ENV["HOMEPATH"] + else + Dir.home(Etc.getlogin) + end end def self.login(github_username, key, dir)
Resolve home path for windows users from environment variables Fixes #20 . My ruby skills are non-existant, but it seems to run here...
diff --git a/spec/controllers/welcome_controller_spec.rb b/spec/controllers/welcome_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/welcome_controller_spec.rb +++ b/spec/controllers/welcome_controller_spec.rb @@ -1,4 +1,4 @@-require 'rails_helper' +require "rails_helper" RSpec.describe WelcomeController, type: :controller do @@ -7,4 +7,23 @@ expect(response.code).to eq "200" end + context "Rails.application.config.esi_enabled" do + render_views + it "should use edge side includes for csrf tags" do + allow(Rails.application.config).to receive(:esi_enabled){ true } + + get :index + expect(response.body).to include(%(<esi:include src="/csrf_protection/meta_tags.html" />)) + end + end + + context "!Rails.application.config.esi_enabled" do + render_views + it "should not use edge side includes for csrf tags" do + allow(Rails.application.config).to receive(:esi_enabled){ false } + + get :index + expect(response.body).not_to include(%(<esi:include src="/csrf_protection/meta_tags.html" />)) + end + end end
Add tests checking for esi:include tag when feature is enabled
diff --git a/spec/lib/heaven/provider/capistrano_spec.rb b/spec/lib/heaven/provider/capistrano_spec.rb index abc1234..def5678 100644 --- a/spec/lib/heaven/provider/capistrano_spec.rb +++ b/spec/lib/heaven/provider/capistrano_spec.rb @@ -3,7 +3,7 @@ describe Heaven::Provider::Capistrano do include FixtureHelper - let(:deployment) { Heaven::Provider::Capistrano.new(SecureRandom.uuid, fixture_data("deployment-capistrano")) } + let(:deployment) { Heaven::Provider::Capistrano.new(SecureRandom.uuid, decoded_fixture_data("deployment-capistrano")) } it "finds deployment task" do expect(deployment.task).to eql "deploy:migrations"
Update capistrano provider spec to use decoded fixture data
diff --git a/core/math/fixtures/classes.rb b/core/math/fixtures/classes.rb index abc1234..def5678 100644 --- a/core/math/fixtures/classes.rb +++ b/core/math/fixtures/classes.rb @@ -3,7 +3,7 @@ end module MathSpecs - class Float + class Float < Numeric def initialize(value=1.0) @value = value end
Math: Make Float fixture inherit from Numeric for 1.9.
diff --git a/lib/capistrano/twelvefactor/tasks/capistrano-twelvefactor.rake b/lib/capistrano/twelvefactor/tasks/capistrano-twelvefactor.rake index abc1234..def5678 100644 --- a/lib/capistrano/twelvefactor/tasks/capistrano-twelvefactor.rake +++ b/lib/capistrano/twelvefactor/tasks/capistrano-twelvefactor.rake @@ -3,31 +3,41 @@ fetch(:environment_file) end + def exec_cmd(cmd) + if fetch(:use_sudo) + sudo cmd + else + execute cmd + end + end + desc 'Set config value by key' task :set, :options do |task, args| - config = Hash[[:key, :value].zip(args[:options].split('='))] + keys = [:key, :value] + config = Hash[keys.zip(args[:options].split('='))] + + unless keys.all? { |k| config.key?(k) && config[k] } + raise 'Pass parameters in the format KEY=value' + end + cmd = Capistrano::Twelvefactor::Command.new(file_name, config) on release_roles :all do - if fetch(:use_sudo) - sudo cmd.set_command - else - execute cmd.set_command - end + exec_cmd cmd.set_command end end desc 'Remove config by key' task :unset, :options do |task, args| - cmd = Capistrano::Twelvefactor::Command.new(file_name, key: args[:options]) + unless key = args[:options] + raise 'Please provide key to remove' + end + + cmd = Capistrano::Twelvefactor::Command.new(file_name, key: key) on release_roles :all do begin - if fetch(:use_sudo) - sudo cmd.unset_command - else - execute cmd.unset_command - end + exec_cmd cmd.unset_command rescue => e unless e.message =~ /Nothing written/ error e
Check if params are valid
diff --git a/lib/convection/model/template/resource/aws_sns_subscription.rb b/lib/convection/model/template/resource/aws_sns_subscription.rb index abc1234..def5678 100644 --- a/lib/convection/model/template/resource/aws_sns_subscription.rb +++ b/lib/convection/model/template/resource/aws_sns_subscription.rb @@ -9,12 +9,14 @@ # endpoint 'failures@example.com' # protocol 'email' # topic_arn 'arn:aws:sns:us-west-2:123456789012:example-topic' + # filter_policy 'Type' => 'Notification', 'MessageId' => 'e3c4e17a-819b-5d95-a0e8-b306c25afda0', 'MessageAttributes' => [{' AttributeName' => 'Name', 'KeyType' => 'HASH' }], # end class SNSSubscription < Resource type 'AWS::SNS::Subscription' property :endpoint, 'Endpoint' property :protocol, 'Protocol' property :topic_arn, 'TopicArn' + property :filter_policy, 'FilterPolicy' end end end
Add filter policy property to sns subscriptions resource
diff --git a/app/workers/wallpaper_purity_locker_worker.rb b/app/workers/wallpaper_purity_locker_worker.rb index abc1234..def5678 100644 --- a/app/workers/wallpaper_purity_locker_worker.rb +++ b/app/workers/wallpaper_purity_locker_worker.rb @@ -7,6 +7,6 @@ def perform Wallpaper.where('updated_at < ?', 1.hour.ago) .where(purity: [:sketchy, :nsfw]) - .update_attribute(:purity_locked, true) + .update_all(purity_locked: true) end end
Use update_all instead of update_attribute
diff --git a/activesupport/lib/active_support/messages/rotation_configuration.rb b/activesupport/lib/active_support/messages/rotation_configuration.rb index abc1234..def5678 100644 --- a/activesupport/lib/active_support/messages/rotation_configuration.rb +++ b/activesupport/lib/active_support/messages/rotation_configuration.rb @@ -9,12 +9,20 @@ @signed, @encrypted = [], [] end - def rotate(kind, *args) + def rotate(kind, *args, **options) case kind when :signed - @signed << args + if options&.any? + @signed << (args << options) + else + @signed << args + end when :encrypted - @encrypted << args + if options&.any? + @encrypted << (args << options) + else + @encrypted << args + end end end end
Unify rotate method definitions to take keyword arguments
diff --git a/examples/parallel-console.rb b/examples/parallel-console.rb index abc1234..def5678 100644 --- a/examples/parallel-console.rb +++ b/examples/parallel-console.rb @@ -5,7 +5,7 @@ usage = <<-EOS Usage: - $ ./parallel-ssh user@host1 user@host2 ... + $ ruby parallel-console.rb user@host1 user@host2 ... EOS abort usage if ARGV.empty? @@ -13,12 +13,20 @@ $stty_state = `stty -g`.chomp $pool = Weave.connect(ARGV) -while command = Readline.readline(">>> ", true) +prompt = ">>> " +while command = Readline.readline(prompt, true) + prompt = ">>> " break unless command # ctrl-D command.chomp! next if command.empty? break if ["exit", "quit"].include? command - $pool.execute { run command } + bad_exit = false + $pool.execute do + result = run(command, :continue_on_failure => true) + bad_exit = result[:exit_code] && result[:exit_code] != 0 + bad_exit ||= result[:exit_signal] + end + prompt = "!!! " if bad_exit end $pool.disconnect!
Update parallel console to use new features.
diff --git a/lib/aasm_with_fixes.rb b/lib/aasm_with_fixes.rb index abc1234..def5678 100644 --- a/lib/aasm_with_fixes.rb +++ b/lib/aasm_with_fixes.rb @@ -1,14 +1,16 @@+module AASM + class StateMachine + def clone + klone = super + klone.states = states.clone + klone.events = events.clone + klone + end + end +end + module AASMWithFixes def self.included(base) base.send(:include, AASM) - base.module_eval do - class << self - def inherited(child) - AASM::StateMachine[child] = AASM::StateMachine[self].clone - AASM::StateMachine[child].events = AASM::StateMachine[self].events.clone - super - end - end - end end -end+end
Update monkey patch to work with AASM 2.0.5
diff --git a/lib/descendants_tracker.rb b/lib/descendants_tracker.rb index abc1234..def5678 100644 --- a/lib/descendants_tracker.rb +++ b/lib/descendants_tracker.rb @@ -13,19 +13,21 @@ # @api public attr_reader :descendants - # Hook called when module is extended + # Setup the class for descendant tracking # # @param [Class<DescendantsTracker>] descendant # # @return [undefined] # # @api private - def self.extended(descendant) + def self.setup(descendant) descendant.instance_variable_set(:@descendants, []) end - singleton_class.class_eval { alias_method :setup, :extended } - private_class_method :extended + class << self + alias_method :extended, :setup + private :extended + end # Add the descendant to this class and the superclass #
Change extended method into setup and alias extended to it * The setup method is what is being used directly so I thought it would be better to have it be the explicitly named method rather than extended, which is only used as a side effect.
diff --git a/app/controllers/attendees_controller.rb b/app/controllers/attendees_controller.rb index abc1234..def5678 100644 --- a/app/controllers/attendees_controller.rb +++ b/app/controllers/attendees_controller.rb @@ -5,7 +5,7 @@ def autocomplete matching_attendees = current_user.attendees.where( "email LIKE ?", - "%#{params[:email]}%" + "%#{params[:email].downcase}%" ).select(:id, :email) render json: matching_attendees
Make attendees autocomplete case insensitive
diff --git a/experian.gemspec b/experian.gemspec index abc1234..def5678 100644 --- a/experian.gemspec +++ b/experian.gemspec @@ -18,7 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency "excon" - spec.add_dependency "builder" + spec.add_dependency "excon", "~> 0.26" + spec.add_dependency "builder", "~> 3.2" spec.add_development_dependency "bundler", "~> 1.3" end
Add required versions for dependent gems
diff --git a/config/locales/plurals.rb b/config/locales/plurals.rb index abc1234..def5678 100644 --- a/config/locales/plurals.rb +++ b/config/locales/plurals.rb @@ -1,34 +1 @@-{ - # Dari - this isn't an iso code. Probably should be 'prs' as per ISO 639-3. - dr: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } }, - # Latin America and Caribbean Spanish - "es-419": { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } }, - # Scottish Gaelic - gd: { i18n: { plural: { keys: %i[one two few other], - rule: - lambda do |n| - if [1, 11].include?(n) - :one - elsif [2, 12].include?(n) - :two - elsif [3, 4, 5, 6, 7, 8, 9, 10, 13, 14, 15, 16, 17, 18, 19].include?(n) - :few - else - :other - end - end } } }, - # Armenian - hy: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } }, - # Kazakh - kk: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } }, - # Punjabi Shahmukhi - "pa-pk": { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } }, - # Sinhalese - si: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } }, - # Uzbek - uz: { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } }, - # Chinese Hong Kong - "zh-hk" => { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } }, - # Chinese Taiwan - "zh-tw" => { i18n: { plural: { keys: %i[one other], rule: ->(n) { n == 1 ? :one : :other } } } }, -} +GovukI18n.plurals
Use plural rules from govuk_app_config We're moving these rules into govuk_app_config so that it is easier to maintain them.
diff --git a/knapsack.gemspec b/knapsack.gemspec index abc1234..def5678 100644 --- a/knapsack.gemspec +++ b/knapsack.gemspec @@ -9,8 +9,8 @@ spec.authors = ["ArturT"] spec.email = ["arturtrzop@gmail.com"] spec.summary = %q{Parallel specs across CI server nodes based on each spec file's time execution.} - spec.description = %q{} - spec.homepage = "" + spec.description = %q{Parallel specs across CI server nodes based on each spec file's time execution. It generates spec time execution report and uses it for further test runs.} + spec.homepage = "https://github.com/ArturT/knapsack" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Update description and homepage for gem
diff --git a/test/controllers/graphql_controller_test.rb b/test/controllers/graphql_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/graphql_controller_test.rb +++ b/test/controllers/graphql_controller_test.rb @@ -12,10 +12,12 @@ test 'should return my profile' do query = <<~GRAPHQL query { - myProfile { - __typename - id - name + convention: conventionByRequestHost { + my_profile { + __typename + id + name + } } } GRAPHQL @@ -25,8 +27,8 @@ json = JSON.parse(response.body) refute json['errors'].present?, json['errors'].to_s - assert_equal 'UserConProfile', json['data']['myProfile']['__typename'] - assert_equal user_con_profile.id, json['data']['myProfile']['id'] - assert_equal user_con_profile.name, json['data']['myProfile']['name'] + assert_equal 'UserConProfile', json['data']['convention']['my_profile']['__typename'] + assert_equal user_con_profile.id.to_s, json['data']['convention']['my_profile']['id'] + assert_equal user_con_profile.name, json['data']['convention']['my_profile']['name'] end end
Fix more deprecated GraphQL queries in tests
diff --git a/test/helpers/checklist_tests_helper_test.rb b/test/helpers/checklist_tests_helper_test.rb index abc1234..def5678 100644 --- a/test/helpers/checklist_tests_helper_test.rb +++ b/test/helpers/checklist_tests_helper_test.rb @@ -2,6 +2,15 @@ class ChecklistTestsHelperTest < ActiveSupport::TestCase include ChecklistTestsHelper + + # This ensures that the filtering on lookup_codevalues properly limits results + # to a specific bundle when specified + def test_lookup_codevalues_multiple_bundles + @bundle1 = FactoryBot.create(:static_bundle) + @bundle2 = FactoryBot.create(:bundle) + + assert_empty lookup_codevalues(@bundle1.value_sets.first.oid, @bundle2) + end def test_checklist_test_criteria_attribute c1 = {}
Add tests to verify that lookup_codevalues is working correctly
diff --git a/shogi_koma.gemspec b/shogi_koma.gemspec index abc1234..def5678 100644 --- a/shogi_koma.gemspec +++ b/shogi_koma.gemspec @@ -20,6 +20,9 @@ spec.add_runtime_dependency("cairo") + spec.add_development_dependency("test-unit") + spec.add_development_dependency("test-unit-notify") + spec.add_development_dependency("test-unit-rr") spec.add_development_dependency("bundler", "~> 1.3") spec.add_development_dependency("rake") end
Add development dependencies for testing
diff --git a/signed_xml.gemspec b/signed_xml.gemspec index abc1234..def5678 100644 --- a/signed_xml.gemspec +++ b/signed_xml.gemspec @@ -10,7 +10,7 @@ gem.email = ["todd.thomas@openlogic.com"] gem.description = %q{XML Signature verification} gem.summary = %q{Provides [incomplete] support for verification of XML Signatures <http://www.w3.org/TR/xmldsig-core>.} - gem.homepage = "" + gem.homepage = "https://github.com/openlogic/signed_xml" gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Set gem homepage to openlogic repo.
diff --git a/two-factor-authentication/verify-webhook/verify-webhook.5.x.rb b/two-factor-authentication/verify-webhook/verify-webhook.5.x.rb index abc1234..def5678 100644 --- a/two-factor-authentication/verify-webhook/verify-webhook.5.x.rb +++ b/two-factor-authentication/verify-webhook/verify-webhook.5.x.rb @@ -0,0 +1,39 @@+require 'uri' + +class CallbackVerifier + + # @param [request] A Rails request object + # @param [api_key] The API key used to sign the request + # @return [boolean] True if verified + def verify_callback(request, api_key) + url = url_for(:only_path => false, :overwrite_params=>nil) + + # Sort and join the parameters + parameter_string = request + .query_parameters + .to_a + .concat(request.request_parameters.to_a) + .sort + .map{ |p| p.join('=')} + .join('&') + + parameter_string = URI.encode(parameter_string) + + # Read the nonce from the request + nonce = request.headers['x-authy-signature-nonce'] + + # Join all request parts using '|' + data = "#{nonce}|#{request.method}|#{url}|#{parameter_string}" + + # Compute the signature + digest = OpenSSL::Digest.new('sha256') + hmac = OpenSSL::HMAC.digest(digest, api_key, data) + hash = Base64.encode64(hmac) + + # Extract the actual request signature + signature = request.headers['x-authy-signature'] + + # Compare the computed signature with the actual signature + hash == signature + end +end
Add verify 2FA webhook signature Ruby snippet
diff --git a/lib/api_call.rb b/lib/api_call.rb index abc1234..def5678 100644 --- a/lib/api_call.rb +++ b/lib/api_call.rb @@ -6,18 +6,24 @@ class Call attr_accessor :title + # Take argument title and set it as instance variable. + # def initialize(title) @title = title @action = 'query' @prop = 'extracts' end + # Make a string that is the URL for the API call. + # def form_string @base = "http://en.wikipedia.org/w/api.php?action=#{@action}&prop=#{@prop}&format=json" @title = URI::encode(@title) @base + '&titles=' + @title end + # Call the API and parse the returning JSON object. + # def call_api JSON.parse(RestClient.get form_string) end
Add brief comments to ApiCall::Call methods.
diff --git a/connector.rb b/connector.rb index abc1234..def5678 100644 --- a/connector.rb +++ b/connector.rb @@ -3,19 +3,50 @@ require 'net/http' require 'json' require 'fileutils' +require 'optparse' + + require './app/chatbot.rb' require './app/chathandler.rb' require './app/consoleinput.rb' +require './app/socketinput.rb' require './app/utils.rb' -# USAGE: connector.rb user pass room $data = {} -$login = { - name: ARGV.shift, - pass: ARGV.shift -} -$room = ARGV.shift || 'showderp' +$login = {} +$options = {room: 'showderp'} + + +op = OptionParser.new do |opts| + opts.banner = 'Usage: connector.rb [options]' + + opts.on('-n', '--name NAME', 'specify name (required)') do |v| + $login[:name] = v + end + + opts.on('-p', '--pass PASS', 'specify password (required)') do |v| + $login[:pass] = v + end + + opts.on('-r', '--room ROOM', 'specify room to join (default is showderp)') do |v| + $options[:room] = v + end + + opts.on_tail('-h', '--help', 'Show this message') do + puts opts + Process.exit + end +end + +if ARGV.empty? + puts op + Process.exit +end + +op.parse!(ARGV) + + if __FILE__ == $0 @@ -28,9 +59,10 @@ # exit #end - EM.run { - bot = Chatbot.new($login[:name], $login[:pass], 'showderp') - } + EM.run do + bot = Chatbot.new($login[:name], $login[:pass], $options[:room]) + EM.start_server('127.0.0.1', 8081, InputServer) + end
Add option parsing, among other changes
diff --git a/lib/datastax_rails/types/binary_type.rb b/lib/datastax_rails/types/binary_type.rb index abc1234..def5678 100644 --- a/lib/datastax_rails/types/binary_type.rb +++ b/lib/datastax_rails/types/binary_type.rb @@ -5,6 +5,7 @@ def encode(str) raise ArgumentError.new("#{self} requires a String") unless str.kind_of?(String) io = StringIO.new(Base64.encode64(str)) + #io = StringIO.new(str) chunks = [] while chunk = io.read(1.megabyte) chunks << chunk @@ -20,6 +21,7 @@ end io.rewind Base64.decode64(io.read) + #io.read else arr end
Reduce memory usage when storing files
diff --git a/lib/tasks/process.rake b/lib/tasks/process.rake index abc1234..def5678 100644 --- a/lib/tasks/process.rake +++ b/lib/tasks/process.rake @@ -1,4 +1,4 @@-namespace :weekly_scheduler do +namespace :redmine_recurring_tasks do desc 'Run issues check' task exec: :environment do date = Time.now
Rename rake task namespace to redmine_recurring_tasks.
diff --git a/lib/travis/features.rb b/lib/travis/features.rb index abc1234..def5678 100644 --- a/lib/travis/features.rb +++ b/lib/travis/features.rb @@ -7,7 +7,8 @@ module Features mattr_accessor :redis, :rollout class << self - delegate *Rollout.public_instance_methods(false), :to => :rollout + methods = Rollout.public_instance_methods(false) << {:to => self} + delegate(*methods) end def self.start
Fix issue on JRuby 1.8.
diff --git a/lib/es/utils.rb b/lib/es/utils.rb index abc1234..def5678 100644 --- a/lib/es/utils.rb +++ b/lib/es/utils.rb @@ -10,7 +10,7 @@ while results['hits']['hits'].any? requests = results['hits']['hits'].each_with_object([]) do |hit, requests| - requests << {index: {_type: hit['_type'], _id: hit['id']}} + requests << {index: {_type: hit['_type'], _id: hit['_id']}} requests << hit['_source'] end @@ -20,4 +20,4 @@ results = from.scroll(scroll: scroll_timeout, scroll_id: scroll_id) end end -end+end
Maintain _id when copying index
diff --git a/lib/fire/cli.rb b/lib/fire/cli.rb index abc1234..def5678 100644 --- a/lib/fire/cli.rb +++ b/lib/fire/cli.rb @@ -3,15 +3,16 @@ module Fire + # Fire's command line interface. # class CLI - # + # Fire her up! def self.run(argv=ARGV) new(argv).run end - # + # Fire her up in autorun mode! def self.autorun(argv=ARGV) new(argv).autorun end @@ -26,33 +27,34 @@ @session ||= Session.new(:watch=>@watch) end - # + # Fire her up! def run args = cli_parse session.run(args) end - # + # Fire her up in autorun mode! def autorun args = cli_parse session.autorun(args) end - # + # Parse command line arguments with just the prettiest + # little CLI parser there ever was. def cli_parse cli @argv, "-T" => method(:list_tasks), "-w" => method(:watch) end - # + # Print out a list of availabe manual triggers. def list_tasks puts "(#{session.root})" puts session.task_sheet exit end - # + # Set the watch wait period. def watch(seconds) @watch = seconds end
Fix CLI and document a little better.
diff --git a/lib/rolistic.rb b/lib/rolistic.rb index abc1234..def5678 100644 --- a/lib/rolistic.rb +++ b/lib/rolistic.rb @@ -28,6 +28,6 @@ end def inspect - to_s + "#<#{self.class} :#{to_s}>" end end
Make inspect slightly more useful
diff --git a/lib/poke/map.rb b/lib/poke/map.rb index abc1234..def5678 100644 --- a/lib/poke/map.rb +++ b/lib/poke/map.rb @@ -7,6 +7,8 @@ include Poke::ReadMap + # Params required at initialization. + PARAMS_REQUIRED = {:map_file} # Creates a Map object. #
Add required params constant to Map
diff --git a/srl-api.gemspec b/srl-api.gemspec index abc1234..def5678 100644 --- a/srl-api.gemspec +++ b/srl-api.gemspec @@ -27,7 +27,7 @@ s.required_ruby_version = '>= 2.3.0' - s.add_development_dependency = 'minitest' - s.add_development_dependency = 'rake' - s.add_development_dependency = 'simplecov' + s.add_development_dependency 'minitest' + s.add_development_dependency 'rake' + s.add_development_dependency 'simplecov' end
Fix derp with dev dependencies.
diff --git a/lib/tasks/static_error_pages_tasks.rake b/lib/tasks/static_error_pages_tasks.rake index abc1234..def5678 100644 --- a/lib/tasks/static_error_pages_tasks.rake +++ b/lib/tasks/static_error_pages_tasks.rake @@ -5,7 +5,7 @@ output = "#{error}.html" puts "Generating #{output}..." outpath = File.join([Rails.root, 'public', output]) - resp = app.get("error/#{error}") + resp = app.get("/error/#{error}") if resp == 301 resp = app.get(app.response.headers['Location']) end
Fix error path for rails 4.2
diff --git a/grit-ext.gemspec b/grit-ext.gemspec index abc1234..def5678 100644 --- a/grit-ext.gemspec +++ b/grit-ext.gemspec @@ -20,7 +20,7 @@ s.test_files = `git ls-files -- {spec}/*`.split("\n") s.require_paths = ['lib'] - s.add_dependency 'grit', '~> 2.5.0' - s.add_development_dependency 'rake', '~> 10.1.0' - s.add_development_dependency 'rspec', '~> 2.13.0' + s.add_runtime_dependency 'grit', '~> 2.5', '>= 2.5.0' + s.add_development_dependency 'rake', '~> 10.1', '>= 10.1.0' + s.add_development_dependency 'rspec', '~> 2.13', '>= 2.13.0' end
Update dependency versioning to not be pessimistic
diff --git a/lib/arel/engines/sql/relations/writes.rb b/lib/arel/engines/sql/relations/writes.rb index abc1234..def5678 100644 --- a/lib/arel/engines/sql/relations/writes.rb +++ b/lib/arel/engines/sql/relations/writes.rb @@ -31,9 +31,13 @@ protected def assignment_sql - assignments.collect do |attribute, value| - "#{engine.quote_column_name(attribute.name)} = #{attribute.format(value)}" - end.join(",\n") + if assignments.respond_to?(:collect) + assignments.collect do |attribute, value| + "#{engine.quote_column_name(attribute.name)} = #{attribute.format(value)}" + end.join(",\n") + else + assignments.value + end end end end
Allow strings as update assignments
diff --git a/grape-route-helpers.gemspec b/grape-route-helpers.gemspec index abc1234..def5678 100644 --- a/grape-route-helpers.gemspec +++ b/grape-route-helpers.gemspec @@ -11,7 +11,7 @@ gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR) gem.homepage = 'https://github.com/reprah/grape-route-helpers' - gem.add_runtime_dependency 'grape', '~> 0.16', '>= 0.16.0' + gem.add_runtime_dependency 'grape', '>= 0.16.0' gem.add_runtime_dependency 'activesupport' gem.add_runtime_dependency 'rake'
Make dependency on grape open-ended
diff --git a/Casks/googleappenginelauncher.rb b/Casks/googleappenginelauncher.rb index abc1234..def5678 100644 --- a/Casks/googleappenginelauncher.rb +++ b/Casks/googleappenginelauncher.rb @@ -1,7 +1,7 @@ class Googleappenginelauncher < Cask - url 'https://commondatastorage.googleapis.com/appengine-sdks/featured/GoogleAppEngineLauncher-1.9.1.dmg' + url 'https://commondatastorage.googleapis.com/appengine-sdks/featured/GoogleAppEngineLauncher-1.9.2.dmg' homepage 'https://developers.google.com/appengine/' - version '1.9.1' - sha256 '73984bedf1f5e764aa2b6673e0e3107cd13a42d12f97b237444e7aaba321bc27' + version '1.9.2' + sha256 '0ba20e175f31c9844c660caf0faa50232400fc006be2ba63e6b769818a43a583' link 'GoogleAppEngineLauncher.app' end
Update Google App Engine Launcher to v1.9.2
diff --git a/config/initializers/edition_services.rb b/config/initializers/edition_services.rb index abc1234..def5678 100644 --- a/config/initializers/edition_services.rb +++ b/config/initializers/edition_services.rb @@ -1,18 +1,50 @@-Whitehall.edition_services.tap do |es| - es.subscribe(/^(force_publish|publish|unwithdraw)$/) { |event, edition, options| ServiceListeners::AuthorNotifier.new(edition, options[:user]).notify! } - es.subscribe(/^(force_publish|publish|unwithdraw|unpublish|withdraw)$/) { |event, edition, options| ServiceListeners::EditorialRemarker.new(edition, options[:user], options[:remark]).save_remark! } - es.subscribe(/^(force_publish|publish|unwithdraw)$/) { |event, edition, options| Whitehall::GovUkDelivery::Notifier.new(edition).edition_published! } - es.subscribe(/^(force_publish|publish|unwithdraw)$/) { |_, edition, _| ServiceListeners::AnnouncementClearer.new(edition).clear! } +Whitehall.edition_services.tap do |coordinator| + # publishing API + coordinator.subscribe do |event, edition, options| + ServiceListeners::PublishingApiPusher + .new(edition) + .push(event: event, options: options) + end - # search - es.subscribe(/^(force_publish|publish|withdraw|unwithdraw)$/) { |_, edition, _| ServiceListeners::SearchIndexer.new(edition).index! } - es.subscribe("unpublish") { |event, edition, options| ServiceListeners::SearchIndexer.new(edition).remove! } + coordinator.subscribe('unpublish') do |_event, edition, _options| + # handling edition's dependency on other content + edition.edition_dependencies.destroy_all - # publishing API - es.subscribe { |event, edition, options| ServiceListeners::PublishingApiPusher.new(edition).push(event: event, options: options) } + # search + ServiceListeners::SearchIndexer + .new(edition) + .remove! + end - # handling edition's dependency on other content - es.subscribe(/^(force_publish|publish|unwithdraw)$/) { |_, edition, _| EditionDependenciesPopulator.new(edition).populate! } - es.subscribe(/^(force_publish|publish|unwithdraw)$/) { |_, edition, _| edition.republish_dependent_editions } - es.subscribe("unpublish") { |_, edition, _| edition.edition_dependencies.destroy_all } + coordinator.subscribe(/^(force_publish|publish|unwithdraw)$/) do |_event, edition, options| + # handling edition's dependency on other content + edition.republish_dependent_editions + EditionDependenciesPopulator + .new(edition) + .populate! + + ServiceListeners::AnnouncementClearer + .new(edition) + .clear! + + ServiceListeners::AuthorNotifier + .new(edition, options[:user]) + .notify! + + Whitehall::GovUkDelivery::Notifier + .new(edition) + .edition_published! + end + + coordinator.subscribe(/^(force_publish|publish|withdraw|unwithdraw)$/) do |_event, edition, _options| + ServiceListeners::SearchIndexer + .new(edition) + .index! + end + + coordinator.subscribe(/^(force_publish|publish|unwithdraw|unpublish|withdraw)$/) do |_event, edition, options| + ServiceListeners::EditorialRemarker + .new(edition, options[:user], options[:remark]) + .save_remark! + end end
Refactor initialiser config for Edition Services Changes to make the code easier to read and understand. * Removes duplicate patterns * Shortens line lengths * Makes method chaining clearer
diff --git a/hideable.gemspec b/hideable.gemspec index abc1234..def5678 100644 --- a/hideable.gemspec +++ b/hideable.gemspec @@ -17,6 +17,6 @@ s.add_development_dependency 'timecop', '~> 0.6.1' s.add_development_dependency 'appraisal', '~> 0.5.2' - s.files = Dir['{lib}/**/*.rb'] + ['README.md'] + s.files = Dir['{lib}/**/*.rb'] + ['README.md', 'LICENSE.txt'] s.require_path = 'lib' end
Update gemspec to include license
diff --git a/lib/quick_travel/status.rb b/lib/quick_travel/status.rb index abc1234..def5678 100644 --- a/lib/quick_travel/status.rb +++ b/lib/quick_travel/status.rb @@ -5,13 +5,13 @@ QuickTravel::Cache.clear QuickTravel::Cache.cache('status-check') { 'start' } unless QuickTravel::Cache.cache('status-check') == 'start' - fail RuntimeError, 'Failed to cache' + fail RuntimeError, 'Failed to cache status-check' end QuickTravel::Cache.clear QuickTravel::Cache.cache('status-check') { nil } unless QuickTravel::Cache.cache('status-check') == nil - fail RuntimeError, 'Failed to cache' + fail RuntimeError, 'Failed to clear status-check cache' end end end
Return DIFFERENT error messages for DIFFERENT problems
diff --git a/lib/sidekiq/cron/poller.rb b/lib/sidekiq/cron/poller.rb index abc1234..def5678 100644 --- a/lib/sidekiq/cron/poller.rb +++ b/lib/sidekiq/cron/poller.rb @@ -19,6 +19,7 @@ # Punt and try again at the next interval logger.error ex.message logger.error ex.backtrace.first + handle_exception(ex) if respond_to?(:handle_exception) end private @@ -29,6 +30,7 @@ # problem somewhere in one job logger.error "CRON JOB: #{ex.message}" logger.error "CRON JOB: #{ex.backtrace.first}" + handle_exception(ex) if respond_to?(:handle_exception) end def poll_interval_average
Handle exception by Sidekiq error handler
diff --git a/cookbooks/rs_utils/recipes/setup_ssh.rb b/cookbooks/rs_utils/recipes/setup_ssh.rb index abc1234..def5678 100644 --- a/cookbooks/rs_utils/recipes/setup_ssh.rb +++ b/cookbooks/rs_utils/recipes/setup_ssh.rb @@ -38,5 +38,9 @@ :private_ssh_key => "#{node.rs_utils.private_ssh_key}" ) end + +else + log "No private key provided, skipping." + end
Add log for no ssh key.
diff --git a/pagelapse.gemspec b/pagelapse.gemspec index abc1234..def5678 100644 --- a/pagelapse.gemspec +++ b/pagelapse.gemspec @@ -8,9 +8,9 @@ spec.version = Pagelapse::VERSION spec.authors = ["Robert Lord"] spec.email = ["robert@lord.io"] - spec.summary = %q{TODO: Write a short summary. Required.} - spec.description = %q{TODO: Write a longer description. Optional.} - spec.homepage = "" + spec.summary = %q{Generates time-lapses of websites, with ease.} + spec.description = %q{} + spec.homepage = "https://github.com/lord/pagelapse" spec.license = "MIT" spec.files = `git ls-files -z`.split("\x0")
Add description and URL to gemspec