diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/lib/console_game_engine.rb b/lib/console_game_engine.rb
index abc1234..def5678 100644
--- a/lib/console_game_engine.rb
+++ b/lib/console_game_engine.rb
@@ -6,10 +6,7 @@ attr_reader :ui
def initialize(args)
- @ttt_board = args.fetch(:ttt_board, nil)
- @rules = args.fetch(:rules, nil)
- @player_1 = args.fetch(:player_1, nil)
- @player_2 = args.fetch(:player_2, nil)
+ super
@ui = args.fetch(:ui, nil)
end
|
Refactor and removed instance variables
|
diff --git a/mixlib-authentication.gemspec b/mixlib-authentication.gemspec
index abc1234..def5678 100644
--- a/mixlib-authentication.gemspec
+++ b/mixlib-authentication.gemspec
@@ -16,6 +16,7 @@ s.add_dependency "mixlib-log"
s.require_path = 'lib'
- s.files = %w(LICENSE README.rdoc Gemfile Rakefile NOTICE) + Dir.glob("{lib,spec}/**/*")
+ s.files = %w(LICENSE README.rdoc Gemfile Rakefile NOTICE) + Dir.glob("*.gemspec") +
+ Dir.glob("{lib,spec}/**/*", File::FNM_DOTMATCH).reject {|f| File.directory?(f) }
end
|
Add gemspec files to allow bundler to run from the gem
|
diff --git a/lib/bouncer/request_context.rb b/lib/bouncer/request_context.rb
index abc1234..def5678 100644
--- a/lib/bouncer/request_context.rb
+++ b/lib/bouncer/request_context.rb
@@ -14,7 +14,7 @@ end
def mapping
- # Reminder: the hash is always calculated on the canonicalize!d request
+ # Reminder: the request's fullpath is canonical
mappings.find_by path: @request.fullpath
end
|
Tidy up comment referring to hash
|
diff --git a/lib/fat_free_crm/engine.rb b/lib/fat_free_crm/engine.rb
index abc1234..def5678 100644
--- a/lib/fat_free_crm/engine.rb
+++ b/lib/fat_free_crm/engine.rb
@@ -17,7 +17,8 @@
module FatFreeCRM
class Engine < ::Rails::Engine
- config.autoload_paths += Dir[root.join("app/models/**")]
+ config.autoload_paths += Dir[root.join("app/models/**")] +
+ Dir[Rails.root.join("app/controllers/entities")]
config.to_prepare do
ActiveRecord::Base.observers = :activity_observer
|
Add entities to Engine autoload_paths
|
diff --git a/lib/carrierwave/storage/aws.rb b/lib/carrierwave/storage/aws.rb
index abc1234..def5678 100644
--- a/lib/carrierwave/storage/aws.rb
+++ b/lib/carrierwave/storage/aws.rb
@@ -1,6 +1,8 @@ # frozen_string_literal: true
require 'aws-sdk-resources'
+
+Aws.eager_autoload!(services: ['S3'])
module CarrierWave
module Storage
|
Use eager_autoload for S3 resource
As explained in the [awsblog][0], aws-sdk is autoloaded to keep the
start time low. That isn't entirely threadsafe and can cause loading
errors in multi threaded systems. To fix this, all of 'S3' is now
eagerly autoloaded.
Fixes #93
[0]: https://ruby.awsblog.com/post/Tx16QY1CI5GVBFT/Threading-with-the-AWS-SDK-for-Ruby
|
diff --git a/RNDeviceInfo.podspec b/RNDeviceInfo.podspec
index abc1234..def5678 100644
--- a/RNDeviceInfo.podspec
+++ b/RNDeviceInfo.podspec
@@ -12,4 +12,5 @@
s.source_files = "RNDeviceInfo/*.{h,m}"
+ s.dependency 'React'
end
|
Add dependency on React pod
|
diff --git a/lib/image_management/engine.rb b/lib/image_management/engine.rb
index abc1234..def5678 100644
--- a/lib/image_management/engine.rb
+++ b/lib/image_management/engine.rb
@@ -3,6 +3,7 @@ isolate_namespace ImageManagement
config.generators do |g|
g.test_framework :rspec, :view_specs => false
+ g.template_engine :haml
end
end
end
|
Add haml generator so we can use scaffolding for base views.
|
diff --git a/spec/controllers/routes_controller_spec.rb b/spec/controllers/routes_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/routes_controller_spec.rb
+++ b/spec/controllers/routes_controller_spec.rb
@@ -15,21 +15,13 @@ }.to_json
end
- it "should not fail on multiple simultaneous requests" do
- bypass_rescue
- failed = false
+ it "should retry on multiple simultaneous requests" do
+ allow(Route).to receive(:find_or_initialize_by)
+ .and_raise(Mongo::Error::OperationFailure, Route::DUPLICATE_KEY_ERROR)
- threads = 4.times.map do
- Thread.new do
- put :update, body: data, format: :json
- rescue Mongo::Error::OperationFailure
- failed = true
- rescue AbstractController::DoubleRenderError
- # this error will happen if both threads succeed, so this is fine.
- end
- end
- threads.each(&:join)
+ expect(Route).to receive(:find_or_initialize_by).exactly(3).times
- expect(failed).to be false
+ expect { put :update, body: data, format: :json }
+ .to raise_error(Mongo::Error::OperationFailure)
end
end
|
Fix flakey test that depended on threads
This rewrites the test to check the underlying behaviour, which is
that we retry a request for a specific kind of error.
|
diff --git a/spec/controllers/visits_controller_spec.rb b/spec/controllers/visits_controller_spec.rb
index abc1234..def5678 100644
--- a/spec/controllers/visits_controller_spec.rb
+++ b/spec/controllers/visits_controller_spec.rb
@@ -1,12 +1,12 @@ require 'rails_helper'
RSpec.describe VisitsController, type: :controller do
- before do skip 'Status not yet implemented' end
+ describe 'show' do
+ let(:visit) { instance_double(Visit, id: '123456789') }
+ let(:pvb_api) { Rails.configuration.pvb_api }
- describe 'show' do
- let(:visit) { create(:visit) }
-
- it 'assigns the visit to @visit' do
+ it 'calls the get visit API' do
+ expect(pvb_api).to receive(:get_visit).with(visit.id).and_return(visit)
get :show, id: visit.id, locale: 'en'
expect(assigns(:visit)).to eq(visit)
end
|
Add simple spec for visit status page
|
diff --git a/spec/features/budget_polls/budgets_spec.rb b/spec/features/budget_polls/budgets_spec.rb
index abc1234..def5678 100644
--- a/spec/features/budget_polls/budgets_spec.rb
+++ b/spec/features/budget_polls/budgets_spec.rb
@@ -9,12 +9,12 @@
scenario "Admin ballots link appears if budget has a poll associated" do
budget = create(:budget)
- create(:poll, budget: budget)
+ poll = create(:poll, budget: budget)
visit admin_budgets_path
within "#budget_#{budget.id}" do
- expect(page).to have_link("Admin ballots")
+ expect(page).to have_link("Admin ballots", admin_poll_path(poll))
end
end
|
Check for link to poll in specs
|
diff --git a/code42.gemspec b/code42.gemspec
index abc1234..def5678 100644
--- a/code42.gemspec
+++ b/code42.gemspec
@@ -10,7 +10,7 @@ gem.email = ["dev-ruby@code42.com"]
gem.description = %q{Provides a Ruby interface to the Code42 API}
gem.summary = %q{...}
- gem.homepage = ""
+ gem.homepage = "http://www.crashplan.com/apidocviewer/"
gem.add_development_dependency 'rspec', '~> 2.11.0'
gem.add_development_dependency 'webmock', '~> 1.11.0'
|
Add link to API documentation in gemspec
|
diff --git a/lib/list_course_manager.rb b/lib/list_course_manager.rb
index abc1234..def5678 100644
--- a/lib/list_course_manager.rb
+++ b/lib/list_course_manager.rb
@@ -30,8 +30,10 @@ end
def send_approval_notification_emails
- @course.instructors.each do |instructor|
- CourseApprovalMailer.send_approval_notification(@course, instructor)
+ # Send emails to each of the instructors as well as Wiki Ed staff and any
+ # other non-students who are part of the course.
+ @course.nonstudents.each do |user|
+ CourseApprovalMailer.send_approval_notification(@course, user)
end
end
end
|
Send approval emails to all nonstudents in course
Content Experts want to get these emails to, they are likely to be helpful for any other users participating in a support role as well.
|
diff --git a/lib/mocha/expectation_error.rb b/lib/mocha/expectation_error.rb
index abc1234..def5678 100644
--- a/lib/mocha/expectation_error.rb
+++ b/lib/mocha/expectation_error.rb
@@ -2,7 +2,7 @@
module Mocha
- class ExpectationError < StandardError
+ class ExpectationError < Exception
def initialize(message = nil, backtrace = [])
super(message)
|
Make ExpectationError inherit from Exception, rather than StandardError
|
diff --git a/Library/Formula/csshx.rb b/Library/Formula/csshx.rb
index abc1234..def5678 100644
--- a/Library/Formula/csshx.rb
+++ b/Library/Formula/csshx.rb
@@ -0,0 +1,12 @@+require 'formula'
+
+class Csshx < Formula
+ url 'http://csshx.googlecode.com/files/csshX-0.72.tgz'
+ homepage 'http://code.google.com/p/csshx/'
+ md5 '15178bbdaaa8f949bd583bd639577232'
+ head 'http://csshx.googlecode.com/svn/trunk/'
+
+ def install
+ bin.install 'csshX'
+ end
+end
|
Add a formula for csshX.
csshX is an SSH multiplexer. It connects to multiple machines via SSH
and lets you enter the same commands on each one of them.
There is no build system, just a single Perl script to be installed into
bin/.
Signed-off-by: Adam Vandenberg <34c2b6407fd5a10249a15d699d40f9ed1782e98c@gmail.com>
|
diff --git a/config/initializers/_splunk_logger.rb b/config/initializers/_splunk_logger.rb
index abc1234..def5678 100644
--- a/config/initializers/_splunk_logger.rb
+++ b/config/initializers/_splunk_logger.rb
@@ -1,5 +1,5 @@ if AppConfig[:enable_splunk_logging]
require File.expand_path('../../../lib/log_overrider', __FILE__)
- Rails.logger.class.send(:include, SplunkLogging)
end
+Rails.logger.class.send(:include, SplunkLogging)
|
Revert "Move the include of splunklogging into the appconfig check"
This reverts commit 25752e9f93a48bdeb292438208bba0e51f6fed0c.
|
diff --git a/config/initializers/exlibris_aleph.rb b/config/initializers/exlibris_aleph.rb
index abc1234..def5678 100644
--- a/config/initializers/exlibris_aleph.rb
+++ b/config/initializers/exlibris_aleph.rb
@@ -0,0 +1,4 @@+# Load all the sub libraries when the application starts
+Exlibris::Aleph::TablesManager.instance.sub_libraries.all
+# Load all the item circulation policies when the application starts
+Exlibris::Aleph::TablesManager.instance.item_circulation_policies.all
|
Load up the Exlibris::Aleph::TablesManager when the application starts to save time
|
diff --git a/lib/rom/sql/commands/update.rb b/lib/rom/sql/commands/update.rb
index abc1234..def5678 100644
--- a/lib/rom/sql/commands/update.rb
+++ b/lib/rom/sql/commands/update.rb
@@ -26,9 +26,14 @@ end
def update(tuple)
- pks = relation.map { |t| t[relation.model.primary_key] }
- relation.update(tuple)
- relation.unfiltered.where(relation.model.primary_key => pks).to_a
+ pks = relation.map { |t| t[primary_key] }
+ dataset = relation.dataset
+ dataset.update(tuple)
+ dataset.unfiltered.where(primary_key => pks).to_a
+ end
+
+ def primary_key
+ relation.primary_key
end
private
|
Use dataset for Update command
|
diff --git a/lib/nifty-report/report.rb b/lib/nifty-report/report.rb
index abc1234..def5678 100644
--- a/lib/nifty-report/report.rb
+++ b/lib/nifty-report/report.rb
@@ -34,7 +34,7 @@ AWS::S3::S3Object.store(filename, csv, ENV['AWS_S3_BUCKET'])
remote_file = AWS::S3::S3Object.find(filename, ENV['AWS_S3_BUCKET'])
- ReportMailer.report_email(email_address, remote_file.url(expires_in: 30)).deliver
+ ReportMailer.report_email(email_address, remote_file.url(expires_in: 30 * 60)).deliver
end
end
end
|
Increase expiration to 30 minutes
|
diff --git a/lib/slack_trello/copy_cards.rb b/lib/slack_trello/copy_cards.rb
index abc1234..def5678 100644
--- a/lib/slack_trello/copy_cards.rb
+++ b/lib/slack_trello/copy_cards.rb
@@ -11,7 +11,7 @@
def run
source_cards.each do |source_card|
- creator = CreateTrelloCard.new(destination_board, destination_list, source_card.name)
+ creator = CreateTrelloCard.new(board_name: destination_board, list_name: destination_list, card_name: source_card.name)
creator.card
end
end
|
Fix a bug in the CopyCards class
|
diff --git a/lib/ama_validators/email_format_validator.rb b/lib/ama_validators/email_format_validator.rb
index abc1234..def5678 100644
--- a/lib/ama_validators/email_format_validator.rb
+++ b/lib/ama_validators/email_format_validator.rb
@@ -1,6 +1,6 @@ class EmailFormatValidator < ActiveModel::EachValidator
def validate_each(object, attribute, value)
- unless value =~ /\A[^@\s]+@([^@\s\.]+\.)+[^@\s\.]+\z/
+ unless value =~ /\A[^`@\s]+@([^@`\s\.]+\.)+[^`@\s\.]+\z/
object.errors[attribute] << (options[:message] || "enter a valid email address (e.g. name@example.com)")
end
end
|
Change email validation regex to reject backticks
* regex now will no accept backticks in any part of the email string
|
diff --git a/lib/something_like_that.rb b/lib/something_like_that.rb
index abc1234..def5678 100644
--- a/lib/something_like_that.rb
+++ b/lib/something_like_that.rb
@@ -1,6 +1,3 @@-require 'bundler'
-Bundler.setup
-
require 'something_like_that/match_phrase'
require 'something_like_that/match_phrase/query'
require 'something_like_that/scorer'
|
Remove extraneous bundler require statement
|
diff --git a/lib/puffer/backends/controllers/tree_base.rb b/lib/puffer/backends/controllers/tree_base.rb
index abc1234..def5678 100644
--- a/lib/puffer/backends/controllers/tree_base.rb
+++ b/lib/puffer/backends/controllers/tree_base.rb
@@ -9,7 +9,10 @@ return super if puffer_filters.any?
@records = resource.collection_scope
if session[:expanded].present?
- @records = @records.where(["depth in (0, 1) or parent_id in (#{session[:expanded].join(', ')})"]).arrange
+ table = resource.model.arel_table
+ @records = @records.where(
+ table[:depth].in([0, 1]).or(table[:parent_id].in(session[:expanded]))
+ ).arrange
else
@records = @records.with_depth([0, 1]).arrange
end
|
Use arel predicates to quote tree expand query
|
diff --git a/db/migrate/20170310101431_add_not_null_contraint_if_company_entity.rb b/db/migrate/20170310101431_add_not_null_contraint_if_company_entity.rb
index abc1234..def5678 100644
--- a/db/migrate/20170310101431_add_not_null_contraint_if_company_entity.rb
+++ b/db/migrate/20170310101431_add_not_null_contraint_if_company_entity.rb
@@ -0,0 +1,5 @@+class AddNotNullContraintIfCompanyEntity < ActiveRecord::Migration
+ def change
+ execute "ALTER TABLE entities ADD CONSTRAINT company_born_at_not_null CHECK (( of_company = TRUE AND born_at IS NOT NULL) OR (of_company = FALSE))"
+ end
+end
|
Add born at postgresql constraint
|
diff --git a/lib/syoboemon/connector.rb b/lib/syoboemon/connector.rb
index abc1234..def5678 100644
--- a/lib/syoboemon/connector.rb
+++ b/lib/syoboemon/connector.rb
@@ -1,3 +1,12 @@+#
+# Syoboemon::Connector module
+#
+
+# しょぼいカレンダーAPIを利用するためのモジュール
+
+require "rubygems"
+require "faraday"
+
module Syoboemon
module Connector
URL = "http://cal.syoboi.jp"
@@ -6,16 +15,16 @@ JSON_PATH = "/json.php"
class << self
- def rss2_get(query)
- connection.get(rss2_path, query)
+ def rss2_get(query_params={})
+ connection.get(rss2_path, query_params)
end
- def db_get(query)
- connection.get(db_path, query)
+ def db_get(query_params={})
+ connection.get(db_path, query_params)
end
- def json_get(query)
- connection.get(json_path, query)
+ def json_get(query_params={})
+ connection.get(json_path, query_params)
end
private
|
Use hash to argument type
|
diff --git a/lib/tasks/coronavirus.rake b/lib/tasks/coronavirus.rake
index abc1234..def5678 100644
--- a/lib/tasks/coronavirus.rake
+++ b/lib/tasks/coronavirus.rake
@@ -23,4 +23,11 @@ puts "title: #{page.title}"
puts "sections_title: #{page.sections_title}"
end
+
+ desc "Sync announcements with entries in the yaml file"
+ task sync_announcements: :environment do
+ CoronavirusPages::AnnouncementsBuilder.new.create_announcements
+
+ puts "Announcements synced for coronavirus landing page..."
+ end
end
|
Add a rake task to sync announcements
Add a rake task to sync the announcements in the database with the ones
in the yaml file.
Usage: rake coronavirus:sync_announcements
|
diff --git a/lib/tasks/republish_accessible_format_request_pilot_documents.rake b/lib/tasks/republish_accessible_format_request_pilot_documents.rake
index abc1234..def5678 100644
--- a/lib/tasks/republish_accessible_format_request_pilot_documents.rake
+++ b/lib/tasks/republish_accessible_format_request_pilot_documents.rake
@@ -0,0 +1,24 @@+desc "Republish all documents with attachments for organisations in accessible format request pilot"
+task repubish_docs_with_attachments_for_accessible_format_request_pilot: :environment do
+ pilot_emails = %w[alternative.formats@education.gov.uk
+ accessible.formats@dwp.gov.uk
+ publications@dhsc.gov.uk
+ different.format@hmrc.gov.uk
+ gov.uk.publishing@dvsa.gov.uk
+ publications@phe.gov.uk].freeze
+
+ organisations = Organisation.where(alternative_format_contact_email: [pilot_emails])
+
+ organisations.each do |org|
+ published_editions_for_org = Edition.latest_published_edition.in_organisation(org)
+ puts "Total editions for #{org.slug}: #{published_editions_for_org.count}"
+ editions_with_attachments = published_editions_for_org.publicly_visible.where(
+ id: Attachment.where(accessible: false, attachable_type: "Edition").select("attachable_id"),
+ )
+ puts "Enqueueing #{editions_with_attachments.count} editions with attachments for #{org.slug}"
+ editions_with_attachments.joins(:document).distinct.pluck("documents.id").each do |document_id|
+ PublishingApiDocumentRepublishingWorker.perform_async_in_queue("bulk_republishing", document_id, true)
+ end
+ puts "Finished enqueueing items for #{org.slug}"
+ end
+end
|
Add temporary Rake task to republish all editions with attachments for accessible format pilot
|
diff --git a/lib/dmm-crawler.rb b/lib/dmm-crawler.rb
index abc1234..def5678 100644
--- a/lib/dmm-crawler.rb
+++ b/lib/dmm-crawler.rb
@@ -1,7 +1,7 @@ require 'mechanize'
module DMMCrawler
- BASE_URL = 'http://www.dmm.co.jp'.freeze
+ BASE_URL = 'https://www.dmm.co.jp'.freeze
end
require 'dmm-crawler/agent'
|
Use HTTPS in all connections
Now `dmm-crawler` using HTTP so it should use HTTPS connection.
|
diff --git a/app/services/tag_importer/fetch_remote_data.rb b/app/services/tag_importer/fetch_remote_data.rb
index abc1234..def5678 100644
--- a/app/services/tag_importer/fetch_remote_data.rb
+++ b/app/services/tag_importer/fetch_remote_data.rb
@@ -32,10 +32,10 @@
def save_row(row)
tagging_spreadsheet.tag_mappings.build(
- content_base_path: row["content_base_path"],
+ content_base_path: String(row["content_base_path"]),
link_title: row["link_title"],
- link_content_id: row["link_content_id"],
- link_type: row["link_type"],
+ link_content_id: String(row["link_content_id"]),
+ link_type: String(row["link_type"]),
state: 'ready_to_tag'
).save
end
|
Handle blank values when processing remote TSV data
We have not null DB constraints on several fields in the TagMapping
model. An import TSV may have blank values in any of its fields. We
should handle these cases and not attempt to persist null values in the
tag_mappings table.
|
diff --git a/set_attributes.gemspec b/set_attributes.gemspec
index abc1234..def5678 100644
--- a/set_attributes.gemspec
+++ b/set_attributes.gemspec
@@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'set_attributes'
- s.version = '0.0.2.2'
+ s.version = '0.0.2.3'
s.summary = "Set an object's attributes from an object or hash with a similar attributes"
s.description = ' '
|
Package version is increased from 0.0.2.2 to 0.0.2.3
|
diff --git a/liquid-validations.gemspec b/liquid-validations.gemspec
index abc1234..def5678 100644
--- a/liquid-validations.gemspec
+++ b/liquid-validations.gemspec
@@ -10,7 +10,7 @@ gem.email = ['dev@bigcartel.com']
gem.description = %q{ ActiveRecord style validations for Liquid content in your ActiveRecord models. See the README to get the lowdown. }
gem.summary = %q{ ActiveRecord style validations for Liquid content in your ActiveRecord models. }
- gem.homepage = 'https://github.com/bigcartel/liquid-validations'
+ gem.homepage = 'https://rubygems.org/gems/liquid-validations'
gem.license = 'MIT'
gem.files = `git ls-files`.split($/)
|
Update gemspec with rubygems url
|
diff --git a/test/cookbooks/bluepill_test/recipes/default.rb b/test/cookbooks/bluepill_test/recipes/default.rb
index abc1234..def5678 100644
--- a/test/cookbooks/bluepill_test/recipes/default.rb
+++ b/test/cookbooks/bluepill_test/recipes/default.rb
@@ -1,13 +1,8 @@-include_recipe 'bluepill'
+include_recipe 'bluepill::default'
# Boring
package 'nc' do
- package_name case node['platform_family']
- when 'debian'
- 'netcat'
- else
- 'nc'
- end
+ package_name node['platform_family'] == 'debian' ? 'netcat' : 'nc'
end
# This fake services uses Netcat to continuously send the secret
|
Remove a funky case statement
|
diff --git a/test/unit/plugins/kernel_v2/config/disk_test.rb b/test/unit/plugins/kernel_v2/config/disk_test.rb
index abc1234..def5678 100644
--- a/test/unit/plugins/kernel_v2/config/disk_test.rb
+++ b/test/unit/plugins/kernel_v2/config/disk_test.rb
@@ -0,0 +1,56 @@+require File.expand_path("../../../../base", __FILE__)
+
+require Vagrant.source_root.join("plugins/kernel_v2/config/disk")
+
+describe VagrantPlugins::Kernel_V2::VagrantConfigDisk do
+ include_context "unit"
+
+ let(:type) { :disk }
+
+ subject { described_class.new(type) }
+
+ let(:machine) { double("machine") }
+
+ def assert_invalid
+ errors = subject.validate(machine)
+ if !errors.empty? { |v| !v.empty? }
+ raise "No errors: #{errors.inspect}"
+ end
+ end
+
+ def assert_valid
+ errors = subject.validate(machine)
+ if !errors.empty? { |v| v.empty? }
+ raise "Errors: #{errors.inspect}"
+ end
+ end
+
+ before do
+ env = double("env")
+
+ subject.name = "foo"
+ subject.size = 100
+ end
+
+ describe "with defaults" do
+ it "is valid with test defaults" do
+ subject.finalize!
+ assert_valid
+ end
+
+ it "sets a command" do
+ subject.finalize!
+ expect(subject.type).to eq(type)
+ end
+
+ it "defaults to primray disk" do
+ subject.finalize!
+ expect(subject.primary).to eq(true)
+ end
+ end
+
+ describe "defining a new config that needs to match internal restraints" do
+ before do
+ end
+ end
+end
|
Add basic disk config unit tests
|
diff --git a/group_node.rb b/group_node.rb
index abc1234..def5678 100644
--- a/group_node.rb
+++ b/group_node.rb
@@ -7,8 +7,9 @@
module Lextacular
class GroupNode
- def initialize *children
+ def initialize *children, &block
@children = children
+ instance_eval &block if block_given?
end
def to_s
|
Add block argument to GroupNode.new
|
diff --git a/lib/rspec-given.rb b/lib/rspec-given.rb
index abc1234..def5678 100644
--- a/lib/rspec-given.rb
+++ b/lib/rspec-given.rb
@@ -1 +1,9 @@+# This file file is to make bundler happy when auto-requiring files
+# based on gem name. If you are manually requiring rspec/given,
+# please use the canonical require file, ie.
+#
+# require 'rspec/given'
+#
+# Thanks.
+
require 'rspec/given'
|
Add explanatory comment to bundler require file.
|
diff --git a/lib/tic_tac_toe.rb b/lib/tic_tac_toe.rb
index abc1234..def5678 100644
--- a/lib/tic_tac_toe.rb
+++ b/lib/tic_tac_toe.rb
@@ -39,12 +39,10 @@ end
def won
- @@win_places.each do |places|
+ @@win_places.map do |places|
marks = places.map { |n| @_marks.at n }
- return marks[0] if marks.all? { |m| m == marks[0] } and marks[0] != " "
- end
-
- nil
+ marks[0] if marks.all? { |m| m == marks[0] } and marks[0] != " "
+ end.find(&:itself)
end
def draw?
|
Restructure won to be slightly more sequence-oriented
|
diff --git a/features/support/env.rb b/features/support/env.rb
index abc1234..def5678 100644
--- a/features/support/env.rb
+++ b/features/support/env.rb
@@ -3,11 +3,13 @@ Before do
# Force ids to be printed unquoted for consistency
set_environment_variable('SHELL', '/usr/bin/bash')
+end
- if RUBY_PLATFORM =~ /java/ || defined?(Rubinius)
- @aruba_timeout_seconds = 120
+Aruba.configure do |config|
+ config.exit_timeout = if RUBY_PLATFORM =~ /java/ || defined?(Rubinius) || (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'truffleruby')
+ 120
else
- @aruba_timeout_seconds = 10
+ 10
end
end
|
Update aruba timeout to use config block
|
diff --git a/lib/paur.rb b/lib/paur.rb
index abc1234..def5678 100644
--- a/lib/paur.rb
+++ b/lib/paur.rb
@@ -1,30 +1,39 @@ require 'optparse'
+require 'fileutils'
require 'paur/submission'
module Paur
class Main
class << self
- attr_reader :category, :verbose
+ include FileUtils
+
+ attr_reader :category, :build_dir, :verbose
def run(argv)
- @category = 'system'
- @verbose = false
+ @category = 'system'
+ @build_dir = '.paur_build'
+ @verbose = false
OptionParser.new do |o|
o.banner = 'Usage: paur [options]'
- o.on('-c', '--category CATEGORY') { |c| @category = c }
- o.on('-v', '--verbose' ) { @verbose = true }
+ o.on('-c', '--category CATEGORY') { |c| @category = c }
+ o.on('-b', '--build-dir DIRECTORY') { |b| @build_dir = b }
+ o.on('-v', '--verbose') { @verbose = true }
end.parse!(argv)
- execute('makepkg -g >> ./PKGBUILD')
+ execute("BUILD_DIR='#{build_dir}' makepkg -g >> ./PKGBUILD")
execute("#{ENV['EDITOR']} ./PKGBUILD")
execute('makepkg --source')
- taurball = Dir.glob('*.src.tar.gz').first
+ taurball = Dir.glob("*.src.tar.gz").first
execute("tar tf '#{taurball}'") if verbose
s = Submission.new(taurball, category)
- execute(s.submit_command)
+ puts(s.submit_command)
+ #execute(s.submit_command)
+
+ rm taurball, :verbose => verbose
+ rm_rf build_dir, :verbose => verbose
rescue => ex
if verbose
|
Set a build_dir option, remove working files
|
diff --git a/test/lib/examples/galena/tissue/helpers/test_case.rb b/test/lib/examples/galena/tissue/helpers/test_case.rb
index abc1234..def5678 100644
--- a/test/lib/examples/galena/tissue/helpers/test_case.rb
+++ b/test/lib/examples/galena/tissue/helpers/test_case.rb
@@ -21,4 +21,4 @@ # Add galena/lib to the Ruby path.
$:.unshift(Galena::ROOT_DIR + '/lib')
-require 'galena/tissue/seed'
+require 'galena/seed'
|
Move shims up in file hierarchy.
|
diff --git a/lps.gemspec b/lps.gemspec
index abc1234..def5678 100644
--- a/lps.gemspec
+++ b/lps.gemspec
@@ -19,4 +19,5 @@ gem.add_development_dependency 'test-unit'
gem.add_development_dependency 'guard'
gem.add_development_dependency 'guard-test'
+ gem.add_development_dependency 'rake'
end
|
Add rake to development dependency for Travis-CI
|
diff --git a/app/models/plugin.rb b/app/models/plugin.rb
index abc1234..def5678 100644
--- a/app/models/plugin.rb
+++ b/app/models/plugin.rb
@@ -6,7 +6,7 @@ before_validation :default_attributes
before_validation :name, uniqueness: {scope: :district_id}
after_create :hook_created
- after_create :hook_updated
+ after_update :hook_updated
after_destroy :hook_destroyed
def hook(trigger, origin, arg=nil)
|
Fix callback type -> after_update
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -4,6 +4,6 @@ license "Apache 2.0"
description "Provides LWRP's for managing Rackspace Cloud resources."
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version "0.1.3"
+version "0.1.4"
depends "xml"
|
Fix for missing file on first converge
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -1,7 +1,7 @@ name 'reprepro'
maintainer 'Tim Smith'
maintainer_email 'tsmith@chef.io'
-license 'Apache 2.0'
+license 'Apache-2.0'
description 'Installs/Configures reprepro for an apt repository'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.4.2'
|
Use SPDX standard license string
Signed-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>
|
diff --git a/core/lib/spree/testing_support/factories/shipping_method_factory.rb b/core/lib/spree/testing_support/factories/shipping_method_factory.rb
index abc1234..def5678 100644
--- a/core/lib/spree/testing_support/factories/shipping_method_factory.rb
+++ b/core/lib/spree/testing_support/factories/shipping_method_factory.rb
@@ -1,8 +1,20 @@ FactoryGirl.define do
- factory :base_shipping_method, class: Spree::ShippingMethod do
+ factory(
+ :shipping_method,
+ aliases: [
+ :base_shipping_method
+ ],
+ class: Spree::ShippingMethod
+ ) do
zones { |a| [Spree::Zone.global] }
name 'UPS Ground'
code 'UPS_GROUND'
+
+ calculator { |s| s.association(:shipping_calculator, strategy: :build, preferred_amount: s.cost) }
+
+ transient do
+ cost 10.0
+ end
before(:create) do |shipping_method, evaluator|
if shipping_method.shipping_categories.empty?
@@ -10,15 +22,8 @@ end
end
- factory :shipping_method, class: Spree::ShippingMethod do
- transient do
- cost 10.0
- end
-
- calculator { |s| s.association(:shipping_calculator, strategy: :build, preferred_amount: s.cost) }
- end
-
factory :free_shipping_method, class: Spree::ShippingMethod do
+ cost nil
association(:calculator, factory: :shipping_no_amount_calculator, strategy: :build)
end
end
|
Convert base_shipping_method factory into an alias
Base_shipping_method was invalid because it doesn't have a calculator.
base_shipping_method isn't used anywhere within core, but it could be
used other applications.
For both of these reasons, base_shipping_method is now an alias for
shipping_method, which is valid.
|
diff --git a/mol.gemspec b/mol.gemspec
index abc1234..def5678 100644
--- a/mol.gemspec
+++ b/mol.gemspec
@@ -17,6 +17,9 @@ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']
+ spec.add_dependency 'activesupport', '~> 4.0.4'
+ spec.add_dependency 'httparty', '~> 0.13.0'
+
spec.add_development_dependency 'bundler', '~> 1.5'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec', '~> 3.0.0.beta2'
|
Add httparty and active support gems
|
diff --git a/db/data_migration/20190709094308_redirect_department_health_atom.rb b/db/data_migration/20190709094308_redirect_department_health_atom.rb
index abc1234..def5678 100644
--- a/db/data_migration/20190709094308_redirect_department_health_atom.rb
+++ b/db/data_migration/20190709094308_redirect_department_health_atom.rb
@@ -0,0 +1,15 @@+base_path = "/government/organisations/department-of-health"
+destination = "/government/organisations/department-of-health-and-social-care"
+redirects = [
+ { path: "#{base_path}.atom", type: "exact", destination: "#{destination}.atom" },
+ { path: base_path, type: "exact", destination: destination }
+]
+redirect = Whitehall::PublishingApi::Redirect.new(base_path, redirects)
+content_id = "b721cee0-b24c-42c0-a8c4-fa215af727eb"
+
+puts "Redirecting: #{base_path} to #{destination} with content_id: #{content_id}"
+
+Services.publishing_api.put_content(content_id, redirect.as_json)
+
+puts "Publishing content_id: #{content_id} with redirect #{redirect.as_json}"
+Services.publishing_api.publish(content_id, nil, locale: "en")
|
Add migration to redirect atom feed
The atom feed was not redirected when the department was renamed
|
diff --git a/app/models/file_asset.rb b/app/models/file_asset.rb
index abc1234..def5678 100644
--- a/app/models/file_asset.rb
+++ b/app/models/file_asset.rb
@@ -9,8 +9,5 @@
has_many :variant_jobs, foreign_key: 'source_file_id', dependent: :nullify
- validates_attachment :resource,
- presence: true,
- size: { in: 0..EBU::UPLOAD_MAX_SIZE }
- #content_type: { content_type: EBU::ALLOWED_CONTENT_TYPES }
+ validates :resource, attachment_size: { in: 0..EBU::UPLOAD_MAX_SIZE }, unless: :is_reference?
end
|
Allow reference file assets to be bigger than allowed.
|
diff --git a/app/models/import_log.rb b/app/models/import_log.rb
index abc1234..def5678 100644
--- a/app/models/import_log.rb
+++ b/app/models/import_log.rb
@@ -13,6 +13,9 @@ :updated, :user_id, :finished_at
attr_accessor :importer
+
+ default_scope order('finished_at DESC')
+
def complete!
update_attributes(
importer_attributes.merge(
@@ -45,12 +48,20 @@
module ClassMethods
def start!(importer)
- create!(
- :filename => importer.filename, :user_id => importer.user.id
- ).tap do |import_log|
+ create!(attributes_for(importer)).tap do |import_log|
import_log.importer = importer
end
end
+ def attributes_for(importer)
+ {
+ :filename => importer.filename, :user_id => importer.user.id,
+ }.merge(extra_attributes_for(importer))
+ end
+
+ def extra_attributes_for(importer)
+ {}
+ end
+
end
end
|
Sort import logs by descending finished_at
|
diff --git a/rally_api.gemspec b/rally_api.gemspec
index abc1234..def5678 100644
--- a/rally_api.gemspec
+++ b/rally_api.gemspec
@@ -18,7 +18,7 @@ s.add_dependency('httpclient', '>= 2.2.4')
#s.files = `git ls-files`.split("\n")
- s.files = %w(README.md Rakefile) + Dir.glob("{lib}/**/*.rb").delete_if { |item| item.include?(".svn") }
+ s.files = %w(README.rdoc Rakefile) + Dir.glob("{lib}/**/*.rb").delete_if { |item| item.include?(".svn") }
#s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
#s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
|
Change gemspec back to rdoc - readme.md is in examples not root dir
|
diff --git a/db/migrate/1431645077_add_length_validation.rb b/db/migrate/1431645077_add_length_validation.rb
index abc1234..def5678 100644
--- a/db/migrate/1431645077_add_length_validation.rb
+++ b/db/migrate/1431645077_add_length_validation.rb
@@ -0,0 +1,8 @@+Sequel.migration do
+ up do
+ execute <<-EOF
+ALTER TABLE bytea_things ADD CONSTRAINT valid_bytea_size
+ CHECK (data IS NULL OR octet_length(data) = 176)
+EOF
+ end
+end
|
Add migration for field length restriction
|
diff --git a/events/lib/social_stream/events/models/actor.rb b/events/lib/social_stream/events/models/actor.rb
index abc1234..def5678 100644
--- a/events/lib/social_stream/events/models/actor.rb
+++ b/events/lib/social_stream/events/models/actor.rb
@@ -5,7 +5,8 @@ extend ActiveSupport::Concern
included do
- has_many :rooms
+ has_many :rooms,
+ dependent: :destroy
end
def events
|
Remove rooms along with their owners
Fixes #440
|
diff --git a/bulk_updater.gemspec b/bulk_updater.gemspec
index abc1234..def5678 100644
--- a/bulk_updater.gemspec
+++ b/bulk_updater.gemspec
@@ -9,6 +9,7 @@ spec.author = "Alex Teut"
spec.email = ["jaturken@gmail.com"]
spec.summary = %q{Generate and execute SQL UPDATE for bulk updating multiple records by one request.}
+ spec.description = %q{Gem for joining multiple UPDATE requests into one. Useful when you regular update multiple record.}
spec.homepage = "https://github.com/jaturken/bulk_updater"
spec.license = "MIT"
@@ -18,6 +19,6 @@ spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.6"
- spec.add_development_dependency "rake"
- spec.add_runtime_dependency 'activerecord'
+ spec.add_development_dependency "rake", '~> 0'
+ spec.add_runtime_dependency 'activerecord', '~> 0'
end
|
Fix warnings while building gem
|
diff --git a/Casks/intellij-idea-ce.rb b/Casks/intellij-idea-ce.rb
index abc1234..def5678 100644
--- a/Casks/intellij-idea-ce.rb
+++ b/Casks/intellij-idea-ce.rb
@@ -1,6 +1,6 @@ cask :v1 => 'intellij-idea-ce' do
- version '14.1.3'
- sha256 'e0e21b9ee9ac881c10b62507eaae4c2dc651bee631fbb9a0fbac9a289d405616'
+ version '14.1.4'
+ sha256 '67c3cf1e6b72ffddb1b8573ddcb407ab3b476a75dbd8e866adbf264bb2daeeb6'
url "http://download.jetbrains.com/idea/ideaIC-#{version}.dmg"
name 'IntelliJ IDEA Community Edition'
|
Update IntelliJ IDEA CE to 14.1.4
|
diff --git a/CSNotificationView.podspec b/CSNotificationView.podspec
index abc1234..def5678 100644
--- a/CSNotificationView.podspec
+++ b/CSNotificationView.podspec
@@ -5,8 +5,8 @@ s.homepage = "https://github.com/problame/CSNotificationView"
s.license = { :type => 'MIT License', :file => "LICENSE.md" }
s.author = 'Christian Schwarz'
- s.source = { :git => 'https://github.com/problame/CSNotificationView.git', :tag => '0.4' }
- s.platform = :ios, '7.0'
+ s.source = { :git => 'https://github.com/problame/CSNotificationView.git', :tag => s.version.to_s }
+ s.platform = :ios, '6.0'
s.requires_arc = true
s.source_files = 'CSNotificationView/*.*'
s.resources = [ 'CSNotificationView/CSNotificationView.xcassets/CSNotificationView_checkmarkIcon.imageset/CSNotificationView_checkmarkIcon.png', 'CSNotificationView/CSNotificationView.xcassets/CSNotificationView_checkmarkIcon.imageset/CSNotificationView_checkmarkIcon@2x.png', 'CSNotificationView/CSNotificationView.xcassets/CSNotificationView_exclamationMarkIcon.imageset/CSNotificationView_exclamationMarkIcon.png', 'CSNotificationView/CSNotificationView.xcassets/CSNotificationView_exclamationMarkIcon.imageset/CSNotificationView_exclamationMarkIcon@2x.png']
|
Update podspec to be compatible with iOS 6
|
diff --git a/Set-1/2.rb b/Set-1/2.rb
index abc1234..def5678 100644
--- a/Set-1/2.rb
+++ b/Set-1/2.rb
@@ -6,9 +6,11 @@
public
def xor(str1, str2)
- h1 = treatAsHex str1
- h2 = treatAsHex str2
- (h1 ^ h2).to_s(16)
+ str1.scan(/\w\w/).zip(str2.scan(/\w\w/)).map { |s1_c, s2_c|
+ h1 = treatAsHex s1_c
+ h2 = treatAsHex s2_c
+ (h1 ^ h2).to_s(16).rjust(2, '0')
+ }.join
end
def help
|
Fix xor method to be able to take large strings as input
|
diff --git a/0_code_wars/format_words_into_a_sentence.rb b/0_code_wars/format_words_into_a_sentence.rb
index abc1234..def5678 100644
--- a/0_code_wars/format_words_into_a_sentence.rb
+++ b/0_code_wars/format_words_into_a_sentence.rb
@@ -0,0 +1,15 @@+# http://www.codewars.com/kata/51689e27fe9a00b126000004/
+# --- iteration 1 ---
+def format_words(words)
+ return "" if words.nil?
+ words.reject!(&:empty?)
+ return "" if words.empty?
+ words.size > 1 ? [words[0...-1].join(", "), words[-1]].join(" and ") : words.first.to_s
+end
+
+# --- iteration 2 ---
+def format_words(words)
+ return "" if words.nil?
+ words.reject!(&:empty?)
+ [words[0...-1].join(", "), words[-1]].compact.reject(&:empty?).join(" and ")
+end
|
Add code wars (6) - format words into a sentence
|
diff --git a/src/db/migrate/20111102125644_alter_metadata_object_value_limit.rb b/src/db/migrate/20111102125644_alter_metadata_object_value_limit.rb
index abc1234..def5678 100644
--- a/src/db/migrate/20111102125644_alter_metadata_object_value_limit.rb
+++ b/src/db/migrate/20111102125644_alter_metadata_object_value_limit.rb
@@ -15,7 +15,7 @@ #
class AlterMetadataObjectValueLimit < ActiveRecord::Migration
def self.up
- execute "ALTER TABLE metadata_objects ALTER COLUMN value TYPE varchar(510)"
+ change_column :metadata_objects, :value, :text
end
def self.down
|
Change sql statement to use rails helpers.
This cause migration to fail on sqlite, due to syntax
differences between RDBMSs.
|
diff --git a/lib/country_code_select/instance_tag.rb b/lib/country_code_select/instance_tag.rb
index abc1234..def5678 100644
--- a/lib/country_code_select/instance_tag.rb
+++ b/lib/country_code_select/instance_tag.rb
@@ -17,7 +17,11 @@ end
countries = countries + options_for_select(COUNTRIES, selected)
- content_tag(:select, countries, options.merge(:id => "#{@object_name}_#{@method_name}", :name => "#{@object_name}[#{@method_name}]"),false)
+ if Rails::VERSION::STRING.to_f < 3
+ content_tag(:select, countries, options.merge(:id => "#{@object_name}_#{@method_name}", :name => "#{@object_name}[#{@method_name}]"))
+ else
+ content_tag(:select, countries, options.merge(:id => "#{@object_name}_#{@method_name}", :name => "#{@object_name}[#{@method_name}]"), false)
+ end
end
end
end
|
Check to see if we are in Rails 3 or not and use the correct content_tag call.
|
diff --git a/lib/fog/google/models/compute/images.rb b/lib/fog/google/models/compute/images.rb
index abc1234..def5678 100644
--- a/lib/fog/google/models/compute/images.rb
+++ b/lib/fog/google/models/compute/images.rb
@@ -12,6 +12,7 @@ GLOBAL_PROJECTS = [ 'google',
'debian-cloud',
'centos-cloud',
+ 'rhel-cloud',
]
def all
|
[google][compute] Add rhel-cloud to project search list
|
diff --git a/lib/generators/typus/views_generator.rb b/lib/generators/typus/views_generator.rb
index abc1234..def5678 100644
--- a/lib/generators/typus/views_generator.rb
+++ b/lib/generators/typus/views_generator.rb
@@ -14,7 +14,10 @@
def copy_views
directory "admin", "app/views/admin"
- directory "layouts/admin", "app/views/layouts/admin"
+ end
+
+ def copy_layouts
+ directory "layouts", "app/views/layouts"
end
end
|
Copy all layouts under the layouts folder.
|
diff --git a/app/helpers/bootstrap_flash_helper.rb b/app/helpers/bootstrap_flash_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/bootstrap_flash_helper.rb
+++ b/app/helpers/bootstrap_flash_helper.rb
@@ -1,12 +1,12 @@ module BootstrapFlashHelper
- ALERT_TYPES = [:error, :info, :success, :warning]
+ ALERT_TYPES = [:danger, :info, :success, :warning]
def bootstrap_flash
output = ''
flash.each do |type, message|
next if message.blank?
type = :success if type == :notice
- type = :error if type == :alert
+ type = :danger if type == :alert
next unless ALERT_TYPES.include?(type)
output += flash_container(type, message)
end
|
Update error flash class by official documentation
|
diff --git a/config/boot.rb b/config/boot.rb
index abc1234..def5678 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -1,4 +1,9 @@ require 'rubygems'
+
+# Need to explicitly use syck for yaml
+require 'yaml'
+YAML::ENGINE.yamler = 'syck'
+
# Set up gems listed in the Gemfile.
if File.exist?(File.expand_path('../../Gemfile', __FILE__))
require 'bundler'
|
Use syck for yaml, fixes an issuew with new delayed job.
|
diff --git a/rails_event_store-rspec/lib/rails_event_store/rspec/have_applied.rb b/rails_event_store-rspec/lib/rails_event_store/rspec/have_applied.rb
index abc1234..def5678 100644
--- a/rails_event_store-rspec/lib/rails_event_store/rspec/have_applied.rb
+++ b/rails_event_store-rspec/lib/rails_event_store/rspec/have_applied.rb
@@ -30,6 +30,10 @@ differ.diff_as_string(expected.to_s, events.to_s)
end
+ def description
+ "have apply events #{events.map(&:class)}"
+ end
+
private
def matches_count?
|
Add description to HaveApplied matcher for doc format
|
diff --git a/config/rake.rb b/config/rake.rb
index abc1234..def5678 100644
--- a/config/rake.rb
+++ b/config/rake.rb
@@ -5,7 +5,7 @@ # Used with the ssl_cert task.
###
-# The company name - used for SSL certificates, and in srvious other places
+# The company name - used for SSL certificates, and in various other places
COMPANY_NAME = "Example Com"
# The Country Name to use for SSL Certificates
|
Fix a minor typo in a comment: srvious => various
|
diff --git a/lib/geocoder/results/bing.rb b/lib/geocoder/results/bing.rb
index abc1234..def5678 100644
--- a/lib/geocoder/results/bing.rb
+++ b/lib/geocoder/results/bing.rb
@@ -4,48 +4,45 @@ class Bing < Base
def address(format = :full)
- data_address['formattedAddress']
+ @data['address']['formattedAddress']
end
def city
- data_address['locality']
+ @data['address']['locality']
end
- def country
- data_address['countryRegion']
- end
-
- def country_code
- # Bing does not return a contry code
- ""
+ def state_code
+ @data['address']['adminDistrict']
end
+ alias_method :state, :state_code
+
+ def country
+ @data['address']['countryRegion']
+ end
+
+ alias_method :country_code, :country
+
def postal_code
- data_address['postalCode']
+ @data['address']['postalCode']
end
-
+
def coordinates
- data_coordinates['coordinates']
+ @data['point']['coordinates']
end
-
- def data_address
+
+ def address_data
@data['address']
end
-
- def data_coordinates
- @data['point']
+
+ def self.response_attributes
+ %w[bbox name confidence entityType]
end
-
- def address_line
- data_address['addressLine']
- end
-
- def state
- data_address['adminDistrict']
- end
-
- def confidence
- @data['confidence']
+
+ response_attributes.each do |a|
+ define_method a do
+ @data[a]
+ end
end
end
end
|
Refactor for consistency with other Results.
|
diff --git a/lib/mangos/mangos_package.rb b/lib/mangos/mangos_package.rb
index abc1234..def5678 100644
--- a/lib/mangos/mangos_package.rb
+++ b/lib/mangos/mangos_package.rb
@@ -18,8 +18,23 @@ end
def update_app
- FileUtils.cp_r(Mangos::Mangos.gem_path + "app/.", mangos_path)
- FileUtils.chmod_R(0755, mangos_path)
+ dev = ENV["MANGOS_ENV"] == "development"
+
+ app_children_paths.each do |file|
+ mangos_file = mangos_path + file.basename
+ FileUtils.rm_rf(mangos_file, :verbose => dev)
+ end
+
+ if dev
+ app_children_paths.each do |file|
+ mangos_file = mangos_path + file.basename
+ FileUtils.ln_sf(file, mangos_file, :verbose => dev)
+ end
+ else
+ FileUtils.cp_r(Mangos::Mangos.gem_path + "app/.", mangos_path, :verbose => dev)
+ end
+
+ FileUtils.chmod_R(0755, mangos_path, :verbose => dev)
end
def self.load_json(path)
@@ -33,4 +48,10 @@ def self.save_json(path, data)
File.open(path, "w") { |f| f << data.to_json }
end
+
+ private
+ def app_children_paths
+ app_path = Mangos::Mangos.gem_path + "app/"
+ app_path.children.reject { |f| f.basename.to_s == "img"} #TODO: Deal with this directory properly
+ end
end
|
Add development mode, and symlink the app files into the gem in development mode only
|
diff --git a/lib/pacer/core/hash_route.rb b/lib/pacer/core/hash_route.rb
index abc1234..def5678 100644
--- a/lib/pacer/core/hash_route.rb
+++ b/lib/pacer/core/hash_route.rb
@@ -2,7 +2,27 @@ module Core
module HashRoute
def lengths
- map(element_type: :integer) { |s| s.length }
+ map(element_type: :integer) { |h| h.length }
+ end
+
+ def keys
+ map(element_type: :array) { |h| h.keys }
+ end
+
+ def values
+ map(element_type: :array) { |h| h.values }
+ end
+
+ def [](k)
+ map { |h| h[k] }
+ end
+
+ def set(k, v)
+ process { |h| h[k] = v }
+ end
+
+ def fetch(k, *d, &block)
+ map { |h| h.fetch(k, *d, &block) }
end
end
end
|
Add some hash route methods.
|
diff --git a/lib/primehosting/database.rb b/lib/primehosting/database.rb
index abc1234..def5678 100644
--- a/lib/primehosting/database.rb
+++ b/lib/primehosting/database.rb
@@ -1,9 +1,7 @@-require 'highline/import'
-
Capistrano::Configuration.instance(true).load do
set :database_name, nil
- set :database_user, Proc.new { ask("What is your database username? ") { |q| q.default = "dbuser" } }
- set :database_pass, Proc.new { ask("What is your database password? ") { |q| q.echo = "*" } }
+ set :database_user, proc { ask("What is your database username? ") { |q| q.default = user } }
+ set :database_pass, proc { ask("What is your database password? ") { |q| q.echo = "*" } }
namespace :database do
task :configure do
@@ -31,4 +29,6 @@ run "cp #{shared_path}/config/database.yml #{release_path}/config/"
end
end
+
+ after "deploy:setup", "database:configure"
end
|
Tweak configure task, set it to run after deploy:setup
|
diff --git a/lib/ubuntu_unused_kernels.rb b/lib/ubuntu_unused_kernels.rb
index abc1234..def5678 100644
--- a/lib/ubuntu_unused_kernels.rb
+++ b/lib/ubuntu_unused_kernels.rb
@@ -23,7 +23,10 @@ end
def get_current
- return '', ''
+ uname = Open3.capture2('uname', '-r').first.chomp
+ match = uname.match(/^(#{KERNEL_VERSION})-([[:alpha:]]+)$/)
+
+ return match[1], match[2]
end
def get_installed(suffix)
|
Implement happy path for get_current.
|
diff --git a/lib/yao/resources/keypair.rb b/lib/yao/resources/keypair.rb
index abc1234..def5678 100644
--- a/lib/yao/resources/keypair.rb
+++ b/lib/yao/resources/keypair.rb
@@ -6,8 +6,8 @@ self.resource_name = "os-keypair"
self.resources_name = "os-keypairs"
- def self.list
- super.map{|r| r[resource_name_in_json] }
+ def self.list(query={})
+ return_resources(GET(resources_name, query).body[resources_name_in_json].map{|r| r[resource_name_in_json] })
end
end
end
|
Fix Yao::Keypair.list would not return instances themselves
|
diff --git a/lib/proxy_pac_rb/rspec/matchers/proxy.rb b/lib/proxy_pac_rb/rspec/matchers/proxy.rb
index abc1234..def5678 100644
--- a/lib/proxy_pac_rb/rspec/matchers/proxy.rb
+++ b/lib/proxy_pac_rb/rspec/matchers/proxy.rb
@@ -13,6 +13,8 @@ @file_a == @file_b
end
+ diffable
+
failure_message do
format(%(expected that proxy.pac "%s" is equal to proxy.pac "%s", but it is not equal.), @file_a.source.truncate_words(10), @file_b.source.truncate_words(10))
end
|
Make the output a diff
|
diff --git a/tasks/metrics/mutant.rake b/tasks/metrics/mutant.rake
index abc1234..def5678 100644
--- a/tasks/metrics/mutant.rake
+++ b/tasks/metrics/mutant.rake
@@ -10,7 +10,7 @@
mutant_present = defined?(Mutant)
- if allowed_versions.include?(Devtools.rvm) and mutant_present and !ENV['DEVTOOLS_SELF']
+ if allowed_versions.include?(Devtools.rvm) && mutant_present && !ENV['DEVTOOLS_SELF']
desc 'Run mutant'
task :mutant => :coverage do
project = Devtools.project
|
Change boolean conditions to use && and not "and"
|
diff --git a/Casks/duckietv.rb b/Casks/duckietv.rb
index abc1234..def5678 100644
--- a/Casks/duckietv.rb
+++ b/Casks/duckietv.rb
@@ -2,7 +2,7 @@ version '1.1.3'
sha256 '4c4ee965cf39db6333dad65fe2b56ebf412af490a1b091487ef5d1fe8989b359'
- # schizoduckie.github.io/DuckieTV was verified as official homepage when first introduced to the cask
+ # schizoduckie.github.io/DuckieTV was verified as official when first introduced to the cask
url "https://github.com/SchizoDuckie/DuckieTV/releases/download/#{version}/DuckieTV-#{version}-OSX-x64.pkg"
appcast 'https://github.com/SchizoDuckie/DuckieTV/releases.atom',
checkpoint: 'f11c61dde34cfe2a9f3e7150122340aa3f6680a634e00851066fccd4668e0103'
|
Fix `url` stanza comment for duckieTV.
|
diff --git a/Casks/stackato.rb b/Casks/stackato.rb
index abc1234..def5678 100644
--- a/Casks/stackato.rb
+++ b/Casks/stackato.rb
@@ -1,11 +1,11 @@ cask :v1 => 'stackato' do
- version '3.2.0'
- sha256 'ba54288e3770c3ad8928c0ad3b5904b552dbe32e2748ed724a38fcb2efc4fb8c'
+ version '3.2.1'
+ sha256 'a2f3eceac381bf018a8435b085c9ed36307e35cc9e8c077bf05aad91f095b2ae'
url "http://downloads.activestate.com/stackato/client/v#{version}/stackato-#{version}-macosx10.5-i386-x86_64.zip"
name 'Stackato'
homepage 'http://docs.stackato.com/user/client/'
- license :unknown # todo: change license and remove this comment; ':unknown' is a machine-generated placeholder
+ license :apache
binary "stackato-#{version}-macosx10.5-i386-x86_64/stackato"
end
|
Update Stackato CLI to v3.2.1
|
diff --git a/lib/issues.rb b/lib/issues.rb
index abc1234..def5678 100644
--- a/lib/issues.rb
+++ b/lib/issues.rb
@@ -1,5 +1,24 @@+$LOAD_PATH.unshift(File.dirname(__FILE__))
+
+require 'pry'
+require 'httparty'
+
require "issues/version"
module Issues
- # Your code goes here...
+ class Github
+ include HTTParty
+ base_uri 'https://api.github.com'
+ basic_auth ENV['GH_USER'], ENV['GH_PASS']
+
+ def list_teams(org_id)
+ self.class.get("/orgs/#{org_id}/teams")
+ end
+
+ def list_members(team_id)
+ self.class.get("/teams/#{team_id}/members")
+ end
+ end
end
+
+binding.pry
|
Add Github class with basic auth and some simple GET methods.
|
diff --git a/lib/quotes.rb b/lib/quotes.rb
index abc1234..def5678 100644
--- a/lib/quotes.rb
+++ b/lib/quotes.rb
@@ -5,6 +5,7 @@
require "quotes/entities"
require "quotes/services"
+require "quotes/use_cases"
module Quotes
end
|
Add use_cases to manifest file
|
diff --git a/AZTabBar.podspec b/AZTabBar.podspec
index abc1234..def5678 100644
--- a/AZTabBar.podspec
+++ b/AZTabBar.podspec
@@ -9,4 +9,5 @@ s.source = { :git => "https://github.com/Minitour/AZTabBarController.git", :tag => "#{s.version}" }
s.source_files = "Sources/**/*.swift"
#s.resources = "Sources/*.xib"
+ s.dependency "EasyNotificationBadge"
end
|
Revert "Removed `EasyNotificationBadge` from podspec dependency."
This reverts commit 5897b8f8a3d2c82a2038987fd36b31197818ded4.
|
diff --git a/detour.gemspec b/detour.gemspec
index abc1234..def5678 100644
--- a/detour.gemspec
+++ b/detour.gemspec
@@ -20,12 +20,12 @@
spec.add_dependency "rails", "~> 3.2.16"
+ spec.add_development_dependency "capybara"
+ spec.add_development_dependency "database_cleaner", "~> 1.2.0"
+ spec.add_development_dependency "factory_girl_rails"
+ spec.add_development_dependency "pry-nav"
+ spec.add_development_dependency "rspec-rails"
spec.add_development_dependency "selenium-webdriver"
- spec.add_development_dependency "database_cleaner", "~> 1.2.0"
- spec.add_development_dependency "capybara"
- spec.add_development_dependency "factory_girl_rails"
- spec.add_development_dependency "pry-debugger"
- spec.add_development_dependency "rspec-rails"
spec.add_development_dependency "shoulda-matchers"
spec.add_development_dependency "sqlite3-ruby"
spec.add_development_dependency "yard"
|
Use pry-nav instead of pry-debugger
|
diff --git a/spec/acceptance/011_service_spec.rb b/spec/acceptance/011_service_spec.rb
index abc1234..def5678 100644
--- a/spec/acceptance/011_service_spec.rb
+++ b/spec/acceptance/011_service_spec.rb
@@ -16,7 +16,7 @@
context "Change the defaults file" do
it 'should run successfully' do
- pp = "class { 'elasticsearch': manage_repo => true, repo_version => '1.0', java_install => true, config => { 'node.name' => 'elasticsearch001' }, init_defaults => { 'USER' => 'root' } }"
+ pp = "class { 'elasticsearch': manage_repo => true, repo_version => '1.0', java_install => true, config => { 'node.name' => 'elasticsearch001' }, init_defaults => { 'ES_USER' => 'root' } }"
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
@@ -25,11 +25,11 @@ end
end
- context "Make sure we have USER=root" do
+ context "Make sure we have ES_USER=root" do
describe file(defaults_file) do
- it { should contain 'USER=root' }
- it { should_not contain 'USER=elasticsearch' }
+ it { should contain 'ES_USER=root' }
+ it { should_not contain 'ES_USER=elasticsearch' }
end
end
|
Make sure we test the right thing
|
diff --git a/spec/features/users_feature_spec.rb b/spec/features/users_feature_spec.rb
index abc1234..def5678 100644
--- a/spec/features/users_feature_spec.rb
+++ b/spec/features/users_feature_spec.rb
@@ -0,0 +1,39 @@+require 'rails_helper'
+
+feature "User visits the website" do
+ scenario "when user signs up" do
+ user = FactoryGirl.create(:user)
+ visit "/users/new"
+ fill_in "user[first_name]", with: user.first_name
+ fill_in "user[last_name]", with: user.last_name
+ fill_in "user[username]", with: user.username
+ fill_in "user[email]", with: user.email
+ fill_in "user[password]", with: user.password
+ click_button "Sign Up"
+ expect(page).to have_content("Log Out")
+ end
+
+ scenario "when user logs in" do
+ user = FactoryGirl.create(:user)
+ visit "/sessions/new"
+ fill_in "user[username]", with: user.username
+ fill_in "user[password]", with: user.password
+ click_button "Log In"
+ expect(page).to have_content("Log Out")
+ end
+
+ scenario "when user logs out" do
+ user = FactoryGirl.create(:user)
+ visit "/sessions/new"
+ fill_in "user[username]", with: user.username
+ fill_in "user[password]", with: user.password
+ click_button "Log In"
+ expect(page).to have_content("Log Out")
+ click_link "Log Out"
+ expect(page).to have_content("Log In")
+ end
+
+
+
+
+end
|
Add feature tests for users
|
diff --git a/app/mutations/task/notifications/invitation_email.rb b/app/mutations/task/notifications/invitation_email.rb
index abc1234..def5678 100644
--- a/app/mutations/task/notifications/invitation_email.rb
+++ b/app/mutations/task/notifications/invitation_email.rb
@@ -6,23 +6,24 @@ end
def execute
- invitees = volunteers.select { |user| user.email.present? }
invitees.each do |user|
token = Token.task_invitation.create! context: { user_id: user.id, task_id: task.id }
TaskMailer.task_invitation(task, user, token).deliver_now
end
- Task::Comments::Invited.run(task: task, message: 'invited', user: current_user, invite_count: invitees.count)
+ Task::Comments::Invited.run(task: task, user: current_user, invite_count: invitees.count)
- OpenStruct.new(volunteers: volunteers)
+ OpenStruct.new(volunteers: invitees)
end
private
- def volunteers
- @volunteers ||= begin
- volunteers = (type == "circle" ? task.circle.volunteers : task.working_group.users)
- volunteers.active.to_a.reject { |u| u == current_user || task.volunteers.include?(u) }
+ def invitees
+ @invitees ||= begin
+ invitees = (type == "circle" ? task.circle.volunteers : task.working_group.users)
+ invitees.active.to_a.reject do |u|
+ u == current_user || task.invitees.include?(u) || !user.email.present?
+ end
end
end
end
|
Simplify invitation email even more
|
diff --git a/Support/lib/rspec/mate.rb b/Support/lib/rspec/mate.rb
index abc1234..def5678 100644
--- a/Support/lib/rspec/mate.rb
+++ b/Support/lib/rspec/mate.rb
@@ -2,7 +2,5 @@
ENV['TM_PROJECT_DIRECTORY'] ||= File.dirname(ENV['TM_FILEPATH'])
-$LOAD_PATH.unshift(File.dirname(__FILE__) + '/..')
-
-require 'rspec/mate/runner'
-require 'rspec/mate/switch_command'
+require_relative 'mate/runner'
+require_relative 'mate/switch_command'
|
Use require_relative instead of messing with $LOAD_PATH
|
diff --git a/lib/adhearsion/foundation/exception_handler.rb b/lib/adhearsion/foundation/exception_handler.rb
index abc1234..def5678 100644
--- a/lib/adhearsion/foundation/exception_handler.rb
+++ b/lib/adhearsion/foundation/exception_handler.rb
@@ -3,7 +3,7 @@ begin
yield
rescue StandardError => e
- Adhearsion::Events.trigger ['exception'], e
+ Adhearsion::Events.trigger :exception, e
end
end
end
|
Fix exception handler helper method
|
diff --git a/react-native-mixpanel.podspec b/react-native-mixpanel.podspec
index abc1234..def5678 100644
--- a/react-native-mixpanel.podspec
+++ b/react-native-mixpanel.podspec
@@ -10,4 +10,5 @@ s.source_files = 'RNMixpanel/*'
s.platform = :ios, "7.0"
s.dependency 'Mixpanel'
+ s.dependency 'React'
end
|
Bring back React as a dependency of the cocoapod
The pod is unable to reference RN's headers when compiled as a framework without RN as a dependency.
Fixes errors like:
```
RNMixpanel.h:9:9: 'RCTBridgeModule.h' file not found
```
|
diff --git a/lib/nfg-rest-client/models/base_transaction.rb b/lib/nfg-rest-client/models/base_transaction.rb
index abc1234..def5678 100644
--- a/lib/nfg-rest-client/models/base_transaction.rb
+++ b/lib/nfg-rest-client/models/base_transaction.rb
@@ -15,10 +15,18 @@ errorDetails.map { |error| "#{error['code']}: #{error["data"]}"}.join()
end
+ def bearer_token= (token)
+ @token = token
+ end
+
+ def bearer_token
+ @token || self.class.token
+ end
+
private
def add_authentication_details(name, request)
- request.headers["Authorization"] = "Bearer #{self.class.token}"
+ request.headers["Authorization"] = "Bearer #{request.object.bearer_token}"
end
end
end
|
Allow the bearer to be set on the instance in addition to the class
|
diff --git a/app/models/obs_factory/distribution_strategy_factory_ppc.rb b/app/models/obs_factory/distribution_strategy_factory_ppc.rb
index abc1234..def5678 100644
--- a/app/models/obs_factory/distribution_strategy_factory_ppc.rb
+++ b/app/models/obs_factory/distribution_strategy_factory_ppc.rb
@@ -19,6 +19,10 @@ 'ports/ppc/factory'
end
+ def openqa_version
+ 'Tumbleweed PowerPC'
+ end
+
def repo_url
'http://download.opensuse.org/ports/ppc/factory/repo/oss/media.1/build'
end
|
Set TW version for PowerPC
Signed-off-by: Dinar Valeev <5117617bf147dfe0d669bc60877f607cdec8696e@suse.com>
|
diff --git a/HUDHelper.podspec b/HUDHelper.podspec
index abc1234..def5678 100644
--- a/HUDHelper.podspec
+++ b/HUDHelper.podspec
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = 'HUDHelper'
- s.version = '0.3.0'
+ s.version = '0.3.1'
s.summary = 'A wrapper of method chaining for MBProgressHUD.'
s.description = <<-DESC
|
Update the version to 0.3.1 in podspec.
|
diff --git a/lib/netsuite/records/journal_entry.rb b/lib/netsuite/records/journal_entry.rb
index abc1234..def5678 100644
--- a/lib/netsuite/records/journal_entry.rb
+++ b/lib/netsuite/records/journal_entry.rb
@@ -39,6 +39,10 @@ "Transaction"
end
+ def self.search_class_namespace
+ "tranSales"
+ end
+
end
end
end
|
Add search namespace override to JournalEntry
The namespace for JournalEntry is tranGeneral, but it's search falls under the Transaction schema with the namespace tranSales. Add a search_class_namespace override to make this work properly.
|
diff --git a/mixlib-log.gemspec b/mixlib-log.gemspec
index abc1234..def5678 100644
--- a/mixlib-log.gemspec
+++ b/mixlib-log.gemspec
@@ -15,5 +15,6 @@ gem.files = Dir["lib/**/*"] + Dir["spec/**/*"] + ["Gemfile", "Rakefile", ".gemtest", "mixlib-log.gemspec"]
gem.add_development_dependency "rake"
gem.add_development_dependency "rspec", "~> 3.4"
+ gem.add_development_dependency "chefstyle", "~> 0.3"
gem.add_development_dependency "cucumber"
end
|
Add dev dependency on chefstyle
|
diff --git a/slickbone.gemspec b/slickbone.gemspec
index abc1234..def5678 100644
--- a/slickbone.gemspec
+++ b/slickbone.gemspec
@@ -3,15 +3,15 @@ require "slickbone/version"
Gem::Specification.new do |s|
- s.name = "slickbone-rails"
+ s.name = "slickbone"
s.version = Slickbone::VERSION
s.authors = ["Steve Whittaker"]
s.email = ["swhitt@gmail.com"]
- s.homepage = "https://github.com/swhitt/slickbone-rails"
+ s.homepage = "https://github.com/swhitt/slickbone"
s.summary = %q{The slickest bone.}
s.description = %q{Happy marry SlickGrid, Backbone.js and Rails}
- s.rubyforge_project = "slickbone-rails"
+ s.rubyforge_project = "slickbone"
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
Drop -rails from the name.
|
diff --git a/app/jobs/cache_browser_channels_json_job.rb b/app/jobs/cache_browser_channels_json_job.rb
index abc1234..def5678 100644
--- a/app/jobs/cache_browser_channels_json_job.rb
+++ b/app/jobs/cache_browser_channels_json_job.rb
@@ -3,7 +3,7 @@
def perform
channels_json = JsonBuilders::ChannelsJsonBuilder.new.build
- Rails.cache.write('browser_channels_json', channels_json)
- Rails.logger.info("CacheBrowserChannelsJsonJob updated the cached browser channels json.")
+ result = Rails.cache.write('browser_channels_json', channels_json)
+ Rails.logger.info("CacheBrowserChannelsJsonJob updated the cached browser channels json. Result: #{result}")
end
end
|
Add the result to the log
|
diff --git a/lib/hooks/view_layouts_base_html_head_hook.rb b/lib/hooks/view_layouts_base_html_head_hook.rb
index abc1234..def5678 100644
--- a/lib/hooks/view_layouts_base_html_head_hook.rb
+++ b/lib/hooks/view_layouts_base_html_head_hook.rb
@@ -3,6 +3,7 @@ class ViewLayoutsBaseHtmlHeadHook < Redmine::Hook::ViewListener
def view_layouts_base_html_head(context={})
if context[:controller] && ( context[:controller].is_a?(IssuesController) ||
+ (Object.const_defined?('ContactsController') && context[:controller].is_a?(ContactsController)) ||
context[:controller].is_a?(WikiController) ||
context[:controller].is_a?(DocumentsController) ||
context[:controller].is_a?(FilesController) ||
|
Support for redmine_contacts has been added
|
diff --git a/plugins/twemproxy/twemproxy-graphite.rb b/plugins/twemproxy/twemproxy-graphite.rb
index abc1234..def5678 100644
--- a/plugins/twemproxy/twemproxy-graphite.rb
+++ b/plugins/twemproxy/twemproxy-graphite.rb
@@ -0,0 +1,89 @@+#!/usr/bin/env ruby
+#
+# Push twemproxy stats into graphite
+# ===
+#
+# DESCRIPTION:
+# This plugin gets the stats data provided by twemproxy
+# and sends it to graphite.
+#
+#
+# DEPENDENCIES:
+# sensu-plugin Ruby gem
+# socket Ruby stdlib
+# timeout Ruby stdlib
+# json Ruby stdlib
+#
+# Copyright 2014 Toni Reina <areina0@gmail.com>
+#
+# Released under the same terms as Sensu (the MIT license); see LICENSE
+# for details.
+
+require 'rubygems' if RUBY_VERSION < '1.9.0'
+require 'sensu-plugin/metric/cli'
+require 'socket'
+require 'timeout'
+require 'json'
+
+class Twemproxy2Graphite < Sensu::Plugin::Metric::CLI::Graphite
+
+ SKIP_ROOT_KEYS = ["service", "source", "version", "uptime", "timestamp"]
+
+ option :host,
+ :description => "Twemproxy stats host to connect to",
+ :short => "-h HOST",
+ :long => "--host HOST",
+ :required => false,
+ :default => "127.0.0.1"
+
+ option :port,
+ :description => "Twemproxy stats port to connect to",
+ :short => "-p PORT",
+ :long => "--port PORT",
+ :required => false,
+ :proc => proc { |p| p.to_i },
+ :default => 22222
+
+ option :scheme,
+ :description => "Metric naming scheme, text to prepend to metric",
+ :short => "-s SCHEME",
+ :long => "--scheme SCHEME",
+ :required => false,
+ :default => "#{Socket.gethostname}.twemproxy"
+
+ option :timeout,
+ :description => "Timeout in seconds to complete the operation",
+ :short => "-t SECONDS",
+ :long => "--timeout SECONDS",
+ :required => false,
+ :proc => proc { |p| p.to_i },
+ :default => 5
+
+ def run
+ begin
+ Timeout.timeout(config[:timeout]) do
+ sock = TCPSocket.new(config[:host], config[:port])
+ data = JSON.parse(sock.read)
+ pools = data.keys - SKIP_ROOT_KEYS
+
+ pools.each do |pool_key|
+ data[pool_key].each do |key, value|
+ if value.is_a?(Hash)
+ value.each do |key_server, value_server|
+ output "#{config[:scheme]}.#{key}.#{key_server}", value_server
+ end
+ else
+ output "#{config[:scheme]}.#{key}", value
+ end
+ end
+ end
+ end
+ ok
+ rescue Timeout::Error
+ warning "Connection timed out"
+ rescue Errno::ECONNREFUSED
+ warning "Can't connect to #{config[:host]}:#{config[:port]}"
+ end
+ end
+
+end
|
Add twemproxy to graphite plugin.
|
diff --git a/0_code_wars/which_are_in.rb b/0_code_wars/which_are_in.rb
index abc1234..def5678 100644
--- a/0_code_wars/which_are_in.rb
+++ b/0_code_wars/which_are_in.rb
@@ -0,0 +1,8 @@+# http://www.codewars.com/kata/550554fd08b86f84fe000a58/
+# --- iteration 1 ---
+def in_array(a1, a2)
+ return [] if a1.empty?
+ a1.select! do |a1_str|
+ a2.any? { |a2_str| a2_str.include?(a1_str) }
+ end.sort
+end
|
Add code wars (6) - which are in
|
diff --git a/spec/factories/tasks.rb b/spec/factories/tasks.rb
index abc1234..def5678 100644
--- a/spec/factories/tasks.rb
+++ b/spec/factories/tasks.rb
@@ -1,6 +1,7 @@ FactoryGirl.define do
factory :task do
title "MyString"
+ description 'Awesome project'
milestone_id 1
assigned_user_id 1
state "new"
|
Add description to task factory.
|
diff --git a/mrblib/ary.rb b/mrblib/ary.rb
index abc1234..def5678 100644
--- a/mrblib/ary.rb
+++ b/mrblib/ary.rb
@@ -5,13 +5,9 @@
def to_v
if size == 0
- Vec::new 0.0, 0.0, 0.0
+ Vec::zero
else
- x = 0.0, y = 0.0, z = 0.0
- if size > 0 then x = self[0].to_f end
- if size > 1 then y = self[1].to_f end
- if size > 2 then z = self[2].to_f end
- Vec::new x, y, z
+ Vec::new self.x, self.y, self.z
end
end
@@ -29,11 +25,11 @@ val.is_a?(Float) ? val : val.to_f
end
def y
- val = (self[2] ||= 0.0)
+ val = (self[1] ||= 0.0)
val.is_a?(Float) ? val : val.to_f
end
def z
- val = (self[1] ||= 0.0)
+ val = (self[2] ||= 0.0)
val.is_a?(Float) ? val : val.to_f
end
|
Fix a critical bug on Array ex class.
|
diff --git a/examples/fizzbuzz.rb b/examples/fizzbuzz.rb
index abc1234..def5678 100644
--- a/examples/fizzbuzz.rb
+++ b/examples/fizzbuzz.rb
@@ -1,5 +1,6 @@ subject "FizzBuzz (1 ~ 15)"
-expected <<EOS
+
+__END__
1
2
Fizz
@@ -15,4 +16,3 @@ 13
14
FizzBuzz
-EOS
|
Fix style of FizzBuzz problem example
|
diff --git a/ruby-review/inheritance.rb b/ruby-review/inheritance.rb
index abc1234..def5678 100644
--- a/ruby-review/inheritance.rb
+++ b/ruby-review/inheritance.rb
@@ -3,12 +3,12 @@ # I worked on this challenge [by myself, with: ].
-# 1. Pseudocode
+# Pseudocode
-# 2. Initial Solution
+# Initial Solution
class GlobalCohort
#your code here
@@ -21,15 +21,10 @@ end
-# 4. Refactored Solution
+# Refactored Solution
-
-# 3. DRIVER TESTS GO BELOW THIS LINE
-
-
-
-# 5. Reflection+# Reflection
|
Remove driver code section and numbering
|
diff --git a/spec/requests/request_throttling_spec.rb b/spec/requests/request_throttling_spec.rb
index abc1234..def5678 100644
--- a/spec/requests/request_throttling_spec.rb
+++ b/spec/requests/request_throttling_spec.rb
@@ -3,6 +3,10 @@ describe 'throttling for xml requests' do
let(:limit) { configatron.direct_auth_request_limit }
+
+ before do
+ configatron.allow_unauthenticated_submissions = true
+ end
before(:each) do
Rack::Attack.cache.store = ActiveSupport::Cache::MemoryStore.new
@@ -26,6 +30,17 @@ end
end
end
+
+ it 'should apply to /m/mission_name/noauth/submission requests above the limit with response code 429' do
+ (limit + 1).times do |i|
+ post "/m/#{get_mission.compact_name}/noauth/submission"
+ if i < limit
+ assert_response :unauthorized
+ else
+ assert_response :too_many_requests
+ end
+ end
+ end
end
context 'with different ip addresses' do
|
203: Add throttling test for noauth/submission
|
diff --git a/spec/thousand_island/style_sheet_spec.rb b/spec/thousand_island/style_sheet_spec.rb
index abc1234..def5678 100644
--- a/spec/thousand_island/style_sheet_spec.rb
+++ b/spec/thousand_island/style_sheet_spec.rb
@@ -2,7 +2,7 @@ describe StyleSheet do
let(:subject) do
dummy = Class.new
- dummy.include(described_class)
+ dummy.send(:include, described_class)
dummy.new
end
let(:expected_styles) { [:h1, :h2, :h3, :h4, :h5, :h6, :body, :footer] }
|
Fix test to deal with access control issue in older Ruby versions
|
diff --git a/db/feature_migrate/20120426073305_create_backlogs.rb b/db/feature_migrate/20120426073305_create_backlogs.rb
index abc1234..def5678 100644
--- a/db/feature_migrate/20120426073305_create_backlogs.rb
+++ b/db/feature_migrate/20120426073305_create_backlogs.rb
@@ -14,7 +14,6 @@ backlog = Backlog.create! name: "backlog", locked: false
sprint_backlog = Backlog.create! name: "sprint_backlog", locked: false
finished_backlog = Backlog.create! name: "finished_backlog", locked: false
- new_issues = Backlog.create! name: "new_issues", locked: false
Issue.all.each do |issue|
if issue.finished
|
Remove new issues list from migration
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.