diff
stringlengths 65
26.7k
| message
stringlengths 7
9.92k
|
|---|---|
diff --git a/lib/tchart/model/separator_item.rb b/lib/tchart/model/separator_item.rb
index abc1234..def5678 100644
--- a/lib/tchart/model/separator_item.rb
+++ b/lib/tchart/model/separator_item.rb
@@ -5,22 +5,22 @@ module TChart
class SeparatorItem
- attr_reader :y_coordinate
- attr_reader :length
+ attr_reader :from
+ attr_reader :to
attr_reader :date_ranges
def initialize
@date_ranges = []
end
- def calc_layout(chart, y_coordinate)
- @y_coordinate = y_coordinate
- @length = chart.x_axis_length
+ def calc_layout(chart, y)
+ @from = Coordinate.new(0, y)
+ @to = Coordinate.new(chart.x_axis_length, y)
end
def render(tex)
tex.comment "horizontal separator line"
- tex.line Coordinate.new(0, y_coordinate), Coordinate.new(length, y_coordinate)
+ tex.line from, to
end
end
|
Convert SeparatorItem to use Coordinates.
|
diff --git a/lib/toy/middleware/identity_map.rb b/lib/toy/middleware/identity_map.rb
index abc1234..def5678 100644
--- a/lib/toy/middleware/identity_map.rb
+++ b/lib/toy/middleware/identity_map.rb
@@ -1,24 +1,8 @@+require 'rack/body_proxy'
+
module Toy
module Middleware
class IdentityMap
- class Body
- def initialize(target, original)
- @target = target
- @original = original
- end
-
- def each(&block)
- @target.each(&block)
- end
-
- def close
- @target.close if @target.respond_to?(:close)
- ensure
- Toy::IdentityMap.enabled = @original
- Toy::IdentityMap.clear
- end
- end
-
def initialize(app)
@app = app
end
@@ -27,9 +11,14 @@ Toy::IdentityMap.clear
enabled = Toy::IdentityMap.enabled
Toy::IdentityMap.enabled = true
- status, headers, body = @app.call(env)
- [status, headers, Body.new(body, enabled)]
+
+ response = @app.call(env)
+ response[2] = Rack::BodyProxy.new(response[2]) {
+ Toy::IdentityMap.enabled = enabled
+ Toy::IdentityMap.clear
+ }
+ response
end
end
end
-end+end
|
Use rack body proxy for the identity map middleware.
|
diff --git a/lib/vagrant/ansible_auto/errors.rb b/lib/vagrant/ansible_auto/errors.rb
index abc1234..def5678 100644
--- a/lib/vagrant/ansible_auto/errors.rb
+++ b/lib/vagrant/ansible_auto/errors.rb
@@ -24,10 +24,12 @@ error_key(:invalid_host_type)
end
+ # Class representing {Command} errors
class CommandError < Vagrant::Errors::VagrantError
error_namespace('vagrant.ansible_auto.errors.command')
end
+ # Raised on receipt of an unrecognized +vagrant ansible+ subcommand
class UnrecognizedCommandError < CommandError
error_key('unrecognized_command')
end
|
Add class docstrings for command error classes
|
diff --git a/Casks/not-tetris.rb b/Casks/not-tetris.rb
index abc1234..def5678 100644
--- a/Casks/not-tetris.rb
+++ b/Casks/not-tetris.rb
@@ -0,0 +1,10 @@+class NotTetris < Cask
+ version '2'
+ sha256 'ddb4df7f9169e1a03cb5f81e67b972cca4470e4925973af452f6e467830aaea8'
+
+ url 'http://stabyourself.net/dl.php?file=nottetris2/nottetris2-osx.zip'
+ homepage 'http://stabyourself.net/nottetris2/'
+ license :oss
+
+ app 'Not Tetris 2.app'
+end
|
Add Not Tetris 2 cask
|
diff --git a/Casks/opera-beta.rb b/Casks/opera-beta.rb
index abc1234..def5678 100644
--- a/Casks/opera-beta.rb
+++ b/Casks/opera-beta.rb
@@ -1,6 +1,6 @@ cask :v1 => 'opera-beta' do
- version '29.0.1795.41'
- sha256 'e7f013637993189ee96409fd647bbc00fa94bde544e2604c36cde230ad717063'
+ version '30.0.1835.18'
+ sha256 '7c27bfd506a5d3a9a41eabd27908344269d1d4f5a85d451d2d2ce0a9ee602993'
url "http://get.geo.opera.com/pub/opera-beta/#{version}/mac/Opera_beta_#{version}_Setup.dmg"
homepage 'http://www.opera.com/computer/beta'
|
Upgrade Opera Beta.app to v30.0.1835.18
|
diff --git a/config/environments/test.rb b/config/environments/test.rb
index abc1234..def5678 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -34,4 +34,7 @@
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
+
+ # Use a different cache store in production
+ config.cache_store = :dalli_store, { :namespace => 'almreport' }
end
|
Switch to dalli store instead of file store for Rails' cache
|
diff --git a/app/forms/artefact_form.rb b/app/forms/artefact_form.rb
index abc1234..def5678 100644
--- a/app/forms/artefact_form.rb
+++ b/app/forms/artefact_form.rb
@@ -23,6 +23,7 @@ self
end
+ alias_method :public_send, :__send__
alias_method :send, :__send__
private
|
Fix displaying of draft tags in forms.
An change in one of the gems has meant that the Form facade methods
are no longer being called when displaying the form, so draft tags are
not being displayed. Adding a public_send alias fixes it.
|
diff --git a/db/migrate/20160108153344_create_responses.rb b/db/migrate/20160108153344_create_responses.rb
index abc1234..def5678 100644
--- a/db/migrate/20160108153344_create_responses.rb
+++ b/db/migrate/20160108153344_create_responses.rb
@@ -2,6 +2,7 @@ def change
create_table :responses do |t|
t.integer :option_id, null: false, index: true
+ t.integer :question_id, null: false, index: true
t.integer :surveys_user_id, null: false, index: true
t.timestamps null: false
|
Edit response migration to include question_id
|
diff --git a/cookbooks/pacman/default.rb b/cookbooks/pacman/default.rb
index abc1234..def5678 100644
--- a/cookbooks/pacman/default.rb
+++ b/cookbooks/pacman/default.rb
@@ -3,6 +3,7 @@ package 'aws-cli'
package 'colordiff'
package 'ctags'
+package 'dhclient'
package 'docker'
package 'exa'
package 'fish'
|
Use dhclient instead of dhcpcd
|
diff --git a/db/migrate/20150411000035_fix_identities.rb b/db/migrate/20150411000035_fix_identities.rb
index abc1234..def5678 100644
--- a/db/migrate/20150411000035_fix_identities.rb
+++ b/db/migrate/20150411000035_fix_identities.rb
@@ -11,13 +11,13 @@ # the first LDAP server specified in gitlab.yml / gitlab.rb.
new_provider = Gitlab.config.ldap.servers.first.last['provider_name']
- # Delete duplicate identities
+ # Delete duplicate identities
execute "DELETE FROM identities WHERE provider = 'ldap' AND user_id IN (SELECT user_id FROM identities WHERE provider = '#{new_provider}')"
# Update legacy identities
execute "UPDATE identities SET provider = '#{new_provider}' WHERE provider = 'ldap';"
- if defined?(LdapGroupLink)
+ if table_exists?('ldap_group_links')
execute "UPDATE ldap_group_links SET provider = '#{new_provider}' WHERE provider IS NULL;"
end
end
|
Check for table instead of class
|
diff --git a/script/daemons/sync_all.rb b/script/daemons/sync_all.rb
index abc1234..def5678 100644
--- a/script/daemons/sync_all.rb
+++ b/script/daemons/sync_all.rb
@@ -3,7 +3,6 @@ require 'rubygems'
loop do
- puts "Fetching at #{ Time.now.to_s(:time) }..."
EvernoteNote.sync_all
Resource.sync_all_binaries
Book.sync_all
|
Remove log message for every run
|
diff --git a/BowerLabs.podspec b/BowerLabs.podspec
index abc1234..def5678 100644
--- a/BowerLabs.podspec
+++ b/BowerLabs.podspec
@@ -1,16 +1,16 @@ Pod::Spec.new do |s|
s.name = 'BowerLabs'
- s.version = '1.1.2'
+ s.version = '1.2.0'
s.platform = :ios
s.license = 'MIT'
s.summary = 'Common frameworks used by Bower Labs projects.'
s.homepage = 'https://github.com/bowerlabs/BowerLabs-Common-iOS'
s.author = { 'Jeremy Bower' => 'jeremy@bowerlabs.com' }
s.source = { :git => 'https://github.com/bowerlabs/BowerLabs-Common-iOS.git',
- :tag => '1.1.2' }
+ :tag => '1.2.0' }
s.requires_arc = true
- s.ios.deployment_target = '7.1'
+ s.ios.deployment_target = '8.3'
s.default_subspec = 'Foundation'
|
Update podspec version and iOS target
|
diff --git a/BowerLabs.podspec b/BowerLabs.podspec
index abc1234..def5678 100644
--- a/BowerLabs.podspec
+++ b/BowerLabs.podspec
@@ -10,7 +10,7 @@ :tag => s.version.to_s }
s.requires_arc = true
- s.ios.deployment_target = '8.3'
+ s.ios.deployment_target = '8.1'
s.default_subspec = 'Foundation'
|
Set the deployment target to iOS 8.1.
|
diff --git a/lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb b/lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
index abc1234..def5678 100644
--- a/lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
+++ b/lib/active_scaffold/bridges/paperclip/lib/paperclip_bridge_helpers.rb
@@ -7,7 +7,7 @@ self.thumbnail_style = :thumbnail
def self.generate_delete_helper(klass, field)
- klass.class_eval <<-EOF, __FILE__, __LINE__ + 1 unless klass.methods.include?("delete_#{field}=")
+ klass.class_eval <<-EOF, __FILE__, __LINE__ + 1 unless klass.instance_methods.include?("delete_#{field}=")
attr_reader :delete_#{field}
def delete_#{field}=(value)
@@ -23,4 +23,4 @@ end
end
end
-end+end
|
Check against instance methods rather than class methods before generating delete helpers.
|
diff --git a/app/controllers/application.rb b/app/controllers/application.rb
index abc1234..def5678 100644
--- a/app/controllers/application.rb
+++ b/app/controllers/application.rb
@@ -1,6 +1,8 @@ # Filters added to this controller will be run for all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
+
+ before_filter :authenticate
def render(args = {})
if ! args[:json].nil?
@@ -14,4 +16,47 @@ end
end
+
+##
+# Taken from http://wiki.rubyonrails.org/rails/pages/HowtoAuthenticateWithHTTP
+##
+ def get_auth_data
+ auth_data = nil
+ [
+ 'REDIRECT_REDIRECT_X_HTTP_AUTHORIZATION',
+ 'REDIRECT_X_HTTP_AUTHORIZATION',
+ 'X-HTTP_AUTHORIZATION',
+ 'HTTP_AUTHORIZATION'
+ ].each do |key|
+ if request.env.has_key?(key)
+ auth_data = request.env[key].to_s.split
+ break
+ end
+ end
+
+ if auth_data && auth_data[0] == 'Basic'
+ return Base64.decode64(auth_data[1]).split(':')[0..1]
+ end
+ end
+
+
+##
+# Authenticate user using HTTP Basic Auth
+##
+ def authenticate
+ login, password = get_auth_data
+ if authorize(login, password)
+ session[:username] = login
+ return true
+ end
+
+ response.headers["Status"] = 'Unauthorized'
+ response.headers['WWW-Authenticate'] = 'Basic realm="ARB"'
+ render :text => "Authentication required", :status => 401
+ end
+
+
+ def authorize(username, password)
+ return username == 'todd'
+ end
end
|
Add HTTP basic auth with fake backend that authenticates user 'todd'
|
diff --git a/app/jobs/include_publisher_in_payout_report_job.rb b/app/jobs/include_publisher_in_payout_report_job.rb
index abc1234..def5678 100644
--- a/app/jobs/include_publisher_in_payout_report_job.rb
+++ b/app/jobs/include_publisher_in_payout_report_job.rb
@@ -34,7 +34,7 @@ when UPHOLD
potential_payment_job = Payout::UpholdService
when MANUAL
- potential_payment_job = ManualPayoutReportPublisherIncluder
+ potential_payment_job = Payout::ManualPayoutReportPublisherIncluder
end
potential_payment_job.new(
|
Fix namespace to use Payout
|
diff --git a/camper_van.gemspec b/camper_van.gemspec
index abc1234..def5678 100644
--- a/camper_van.gemspec
+++ b/camper_van.gemspec
@@ -20,8 +20,8 @@
s.required_ruby_version = "~> 1.9.2"
- s.add_dependency "eventmachine", "~> 0.12.10"
- s.add_dependency "firering", "~> 1.2.0"
+ s.add_dependency "eventmachine", "~> 1.0.3"
+ s.add_dependency "firering", "~> 1.3.0"
s.add_dependency "logging", "~> 1.5.1"
s.add_dependency "trollop", "~> 1.16.2"
|
Update to latest eventmachine/firering releases
Closes #29, closes #35
|
diff --git a/app/helpers/sessions_helper.rb b/app/helpers/sessions_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/sessions_helper.rb
+++ b/app/helpers/sessions_helper.rb
@@ -0,0 +1,21 @@+module CherryTomato
+ class SessionsHelper < Sinatra::Base
+ configure do
+ enable :sessions
+ end
+
+ module UserSession
+ def logged_in?
+ not session[:user].nil?
+ end
+
+ def current_user
+ session[:user]
+ end
+
+ def logout!
+ session[:user] = nil
+ end
+ end
+ end
+end
|
Add SessionsHelper & UserSession helper methods
|
diff --git a/app/helpers/template_helper.rb b/app/helpers/template_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/template_helper.rb
+++ b/app/helpers/template_helper.rb
@@ -1,16 +1,33 @@ module TemplateHelper
+ def template(model: nil, collection: nil, target:, &block)
+ model_name = if collection.present?
+ ActiveModel::Naming.singular(LineItem.first)
+ else
+ model
+ end
- def template(collection:, &block)
- content_for :kindred_script do
- js(
- args: {
- template: capture(&block),
- collection: collection.to_json,
- },
- rendered: true
- )
- end
+ @kindred_hash ||= {}
+ @kindred_hash.merge!({
+ model_name => {
+ template: capture(&block),
+ collection: collection,
+ }
+ })
+ self.controller.instance_variable_set(:@kindred_hash, @kindred_hash)
+ return nil
end
+
+ # def template(collection:, &block)
+ # content_for :kindred_script do
+ # js(
+ # args: {
+ # template: capture(&block),
+ # collection: collection.to_json,
+ # },
+ # rendered: true
+ # )
+ # end
+ # end
# TODO write five methods for each type of input
def text_field_tag_for(object_or_class_name, attribute)
|
Allow template to be nested
|
diff --git a/app/models/concerns/wp_post.rb b/app/models/concerns/wp_post.rb
index abc1234..def5678 100644
--- a/app/models/concerns/wp_post.rb
+++ b/app/models/concerns/wp_post.rb
@@ -12,7 +12,8 @@ end
self.wp_id = json['ID']
- self.published_at = json['date']
+ # Use gmt date to ignore timezone settings in WordPress
+ self.published_at = json['date_gmt']
self.order = json['menu_order']
save!
end
|
Use gmt date to ignore wordpress timezone settings
|
diff --git a/app/uploaders/file_uploader.rb b/app/uploaders/file_uploader.rb
index abc1234..def5678 100644
--- a/app/uploaders/file_uploader.rb
+++ b/app/uploaders/file_uploader.rb
@@ -1,6 +1,7 @@ # encoding: utf-8
class FileUploader < CarrierWave::Uploader::Base
include UploaderHelper
+ MARKDOWN_PATTERN = %r{\!?\[.*?\]\(/uploads/(?<secret>[0-9a-f]{32})/(?<file>.*?)\)}
storage :file
|
Add markdown pattern for uploads to file uploader
|
diff --git a/app/controllers/api/v2/services_controller.rb b/app/controllers/api/v2/services_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/api/v2/services_controller.rb
+++ b/app/controllers/api/v2/services_controller.rb
@@ -8,7 +8,7 @@ type = params[:type].to_s.titleize
@services = Service.published
@services = @services.where(type: type) if type.present?
- render(success_response(@services))
+ render(success_response(@services.order(:name)))
end
end
|
Return paratransit services in alphabetic order in the transportation options page.
|
diff --git a/app/controllers/authentications_controller.rb b/app/controllers/authentications_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/authentications_controller.rb
+++ b/app/controllers/authentications_controller.rb
@@ -1,3 +1,4 @@+require './lib/actions/oauth_signup_action'
class AuthenticationsController < ApplicationController
before_action :authenticate_member!
load_and_authorize_resource
|
Fix Growstuff::OauthSignupAction not found error when connecting flickr account
|
diff --git a/app/views/api/v1/stickies/index.json.jbuilder b/app/views/api/v1/stickies/index.json.jbuilder
index abc1234..def5678 100644
--- a/app/views/api/v1/stickies/index.json.jbuilder
+++ b/app/views/api/v1/stickies/index.json.jbuilder
@@ -14,6 +14,7 @@ json.is_deleted sticky.deleted?
json.url sticky.page.url
json.title sticky.page.title
+ json.visual_url sticky.page.visual_url
json.tags sticky.tags.map {|t| t.name}
end
|
Add visual_url to stickies api reposponse
|
diff --git a/app/workers/trending_groups_refresh_worker.rb b/app/workers/trending_groups_refresh_worker.rb
index abc1234..def5678 100644
--- a/app/workers/trending_groups_refresh_worker.rb
+++ b/app/workers/trending_groups_refresh_worker.rb
@@ -2,7 +2,10 @@ include Sidekiq::Worker
include Sidetiq::Schedulable
- recurrence { minutely(5) }
+ # Because minutely(int) is slow as balls
+ # See tobiassvn/sidetiq#31
+ recurrence { hourly.minute_of_hour(00, 05, 10, 15, 20, 25,
+ 30, 35, 40, 45, 50, 55) }
def perform
TrendingGroup.connection.execute('REFRESH MATERIALIZED VIEW trending_groups')
|
Switch from minutely(5) to hourly.minute_of_hour
Workaround for tobiassvn/sidetiq#31
|
diff --git a/custodian.gemspec b/custodian.gemspec
index abc1234..def5678 100644
--- a/custodian.gemspec
+++ b/custodian.gemspec
@@ -20,6 +20,7 @@
# specify any dependencies here; for example:
s.add_development_dependency "rspec"
+ s.add_development_dependency "rack-test"
s.add_runtime_dependency "thin"
s.add_runtime_dependency "rack"
s.add_runtime_dependency "active_support"
|
Add development dependency on rack-test
|
diff --git a/restaurant_roulette/app/controllers/text_messages_controller.rb b/restaurant_roulette/app/controllers/text_messages_controller.rb
index abc1234..def5678 100644
--- a/restaurant_roulette/app/controllers/text_messages_controller.rb
+++ b/restaurant_roulette/app/controllers/text_messages_controller.rb
@@ -8,5 +8,27 @@ @twilioVersionMsg = 'Hello World! Currently running version ' + Twilio::VERSION + \
' of the twilio-ruby library.'
p "twilio message: #{@twilioVersionMsg}"
+
+ account_sid = "AC6882f6d03c767dfed68ddd6e61554b76"
+ auth_token = "b6c51acfab9f2d0ceefee450d074cc2c"
+ client = Twilio::REST::Client.new account_sid, auth_token
+
+ from = "+15105008394" # Your Twilio number
+
+ friends = {
+ "+19097628390" => "Anne",
+ "+15103043300" => "Utsab",
+ "+16508787883" => "Gabby",
+ "+14085134453" => "Priyanka"
+ }
+
+ friends.each do |key, value|
+ client.account.messages.create(
+ :from => from,
+ :to => key,
+ :body => "Hey #{value}, We're going out for food. Fill out this form: http://restaurant-roullete.heroku.com/events/143"
+ )
+ puts "Sent message to #{value}"
+ end
end
end
|
Send text messages with Twilio to hardcoded phone numbers
|
diff --git a/Purchases.podspec b/Purchases.podspec
index abc1234..def5678 100644
--- a/Purchases.podspec
+++ b/Purchases.podspec
@@ -9,7 +9,7 @@
s.homepage = "http://revenue.cat"
s.license = { :type => 'MIT' }
- s.author = { "Revenue Cat Inc." => "jacob@revenuecat.com" }
+ s.author = { "Revenue Cat, Inc." => "jacob@revenuecat.com" }
s.source = { :git => "https://github.com/revenuecat/purchases-ios.git", :tag => s.version.to_s }
s.ios.deployment_target = '9.0'
@@ -17,4 +17,9 @@ s.source_files = [
'Purchases/Classes/**/*'
]
+
+ s.public_header_files = [
+ "Purchases/Classes/Public/*.h"
+ ]
+
end
|
Add public headers to podspec.
|
diff --git a/cookbooks/cumulus/test/integration/default/serverspec/bonds_spec.rb b/cookbooks/cumulus/test/integration/default/serverspec/bonds_spec.rb
index abc1234..def5678 100644
--- a/cookbooks/cumulus/test/integration/default/serverspec/bonds_spec.rb
+++ b/cookbooks/cumulus/test/integration/default/serverspec/bonds_spec.rb
@@ -0,0 +1,14 @@+require 'serverspec'
+
+set :backend, :exec
+set :path, '/bin:/usr/bin:/sbin/usr/sbin'
+
+intf_dir = File.join('', 'etc', 'network', 'interfaces.d')
+
+# Should have been created by the cumulus_bond resource
+describe file("#{intf_dir}/bond0") do
+ it { should be_file }
+ its(:content) { should match(/iface bond0/) }
+ its(:content) { should match(/bond-slaves swp1 swp2 swp4/) }
+ its(:content) { should match(/clag-id 42/) }
+end
|
Add tests for cumulus_bond provider
|
diff --git a/lib/active_mocker/rspec_helper.rb b/lib/active_mocker/rspec_helper.rb
index abc1234..def5678 100644
--- a/lib/active_mocker/rspec_helper.rb
+++ b/lib/active_mocker/rspec_helper.rb
@@ -1,6 +1,7 @@ require 'active_mocker/loaded_mocks'
require 'active_mocker/rspec'
+ActiveMocker::LoadedMocks.disable_global_state = true
RSpec.configure do |config|
|
Set defaults for loaded mocks
|
diff --git a/lib/bipbip/plugin/socket_redis.rb b/lib/bipbip/plugin/socket_redis.rb
index abc1234..def5678 100644
--- a/lib/bipbip/plugin/socket_redis.rb
+++ b/lib/bipbip/plugin/socket_redis.rb
@@ -24,7 +24,7 @@ uri = URI.parse(url)
request = Net::HTTP::Get.new(uri)
- request['authorization'] = "token #{config['status_token']}"
+ request['authorization'] = "token #{config['status_token']}" if config['status_token']
response = Net::HTTP.start(uri.hostname, uri.port) do |http|
http.request(request)
|
Set "authorization" header only if status_token is provided
|
diff --git a/app/workers/asset_manager_attachment_access_limited_worker.rb b/app/workers/asset_manager_attachment_access_limited_worker.rb
index abc1234..def5678 100644
--- a/app/workers/asset_manager_attachment_access_limited_worker.rb
+++ b/app/workers/asset_manager_attachment_access_limited_worker.rb
@@ -2,21 +2,21 @@ def perform(attachment_data_id)
attachment_data = AttachmentData.find_by(id: attachment_data_id)
return unless attachment_data.present?
- access_limited = []
+ access_limited_to_these_users = []
if attachment_data.access_limited?
- access_limited = AssetManagerAccessLimitation.for(attachment_data.access_limited_object)
+ access_limited_to_these_users = AssetManagerAccessLimitation.for(attachment_data.access_limited_object)
end
- enqueue_job(attachment_data, attachment_data.file, access_limited)
+ enqueue_job(attachment_data, attachment_data.file, access_limited_to_these_users)
if attachment_data.pdf?
- enqueue_job(attachment_data, attachment_data.file.thumbnail, access_limited)
+ enqueue_job(attachment_data, attachment_data.file.thumbnail, access_limited_to_these_users)
end
end
private
- def enqueue_job(attachment_data, uploader, access_limited)
+ def enqueue_job(attachment_data, uploader, access_limited_to_these_users)
legacy_url_path = uploader.asset_manager_path
- AssetManagerUpdateAssetWorker.new.perform(attachment_data, legacy_url_path, 'access_limited' => access_limited)
+ AssetManagerUpdateAssetWorker.new.perform(attachment_data, legacy_url_path, "access_limited" => access_limited_to_these_users)
end
end
|
Make access limited asset worker easier to follow
|
diff --git a/unshorten.gemspec b/unshorten.gemspec
index abc1234..def5678 100644
--- a/unshorten.gemspec
+++ b/unshorten.gemspec
@@ -6,6 +6,7 @@ s.description = 'Get original URLs from shortened ones'
s.authors = ["Wu Jun"]
s.email = 'quark@lihdd.net'
+ s.homepage = 'https://github.com/quark-zju/unshorten'
s.require_paths = ['lib']
s.files = Dir['lib/*{,/*}']
s.test_files = Dir['test/*']
|
Set github as gemspec homepage
|
diff --git a/lib/sinatra_more/warden_plugin.rb b/lib/sinatra_more/warden_plugin.rb
index abc1234..def5678 100644
--- a/lib/sinatra_more/warden_plugin.rb
+++ b/lib/sinatra_more/warden_plugin.rb
@@ -1,11 +1,32 @@ require File.dirname(__FILE__) + '/support_lite'
+require 'warden' unless defined?(Warden)
load File.dirname(__FILE__) + '/markup_plugin/output_helpers.rb'
Dir[File.dirname(__FILE__) + '/warden_plugin/**/*.rb'].each {|file| load file }
module SinatraMore
module WardenPlugin
+ # This is the basic password strategy for authentication
+ class BasicPassword < Warden::Strategies::Base
+ def valid?
+ username || password
+ end
+
+ def authenticate!
+ u = User.authenticate(username, password)
+ u.nil? ? fail!("Could not log in") : success!(u)
+ end
+
+ def username
+ params['username'] || params['nickname'] || params['login'] || params['email']
+ end
+
+ def password
+ params['password'] || params['pass']
+ end
+ end
+
def self.registered(app)
- raise "WardenPlugin::Error - Install with 'sudo gem install warden' or require 'warden' in your app." unless Warden::Manager
+ raise "WardenPlugin::Error - Install warden with 'sudo gem install warden' to use plugin!" unless Warden && Warden::Manager
app.use Warden::Manager do |manager|
manager.default_strategies :password
manager.failure_app = app
@@ -16,25 +37,7 @@ # TODO Improve serializing methods
Warden::Manager.serialize_into_session{ |user| user.nil? ? nil : user.id }
Warden::Manager.serialize_from_session{ |id| id.nil? ? nil : User.find(id) }
-
- Warden::Strategies.add(:password) do
- def valid?
- username || password
- end
-
- def authenticate!
- u = User.authenticate(username, password)
- u.nil? ? fail!("Could not log in") : success!(u)
- end
-
- def username
- params['username'] || params['nickname'] || params['login'] || params['email']
- end
-
- def password
- params['password'] || params['pass']
- end
- end
+ Warden::Strategies.add(:password, BasicPassword)
end
end
end
|
Refactor warden plugin strategy to be defined as class instead of block
|
diff --git a/lib/foodcritic/rake_task.rb b/lib/foodcritic/rake_task.rb
index abc1234..def5678 100644
--- a/lib/foodcritic/rake_task.rb
+++ b/lib/foodcritic/rake_task.rb
@@ -19,7 +19,11 @@ task(name) do
puts "Starting Foodcritic linting..."
result = FoodCritic::Linter.new.check(default_options.merge(options))
- printer = options[:context] ? ContextOutput.new : SummaryOutput.new
+ printer = if options[:context]
+ ContextOutput.new($stdout)
+ else
+ SummaryOutput.new($stdout)
+ end
printer.output(result) if result.warnings.any?
abort if result.failed?
puts "Completed!"
|
Fix a regression when running Foodcritic as a Rake task
The Output classes' initializers now [require](https://github.com/acrmp/foodcritic/commit/3c057cb857939b6761effb386fe0b30e9270add2)
an output stream argument.
Signed-off-by: Jonathan Hartman <5c2dd944dde9e08881bef0894fe7b22a5c9c4b06@p4nt5.com>
|
diff --git a/devtools.gemspec b/devtools.gemspec
index abc1234..def5678 100644
--- a/devtools.gemspec
+++ b/devtools.gemspec
@@ -14,5 +14,6 @@ gem.test_files = `git ls-files -- spec`.split("\n")
gem.extra_rdoc_files = %w[TODO]
- gem.add_runtime_dependency('adamantium', '~> 0.0.3')
+ gem.add_dependency('rake', '~> 10.0')
+ gem.add_dependency('adamantium', '~> 0.0.3')
end
|
Add rake to runtime deps
closes #3
|
diff --git a/lib/mongo_rates/rateable.rb b/lib/mongo_rates/rateable.rb
index abc1234..def5678 100644
--- a/lib/mongo_rates/rateable.rb
+++ b/lib/mongo_rates/rateable.rb
@@ -19,7 +19,6 @@ end
def average_rating
- rateable_ratings = ratings
return 0 if ratings.empty?
map = %Q(function() {
@@ -32,7 +31,7 @@ })
output_collection = "mongo_rates.models.ratings.#{self.class.to_s.downcase}#{id}"
- rateable_ratings.collection.map_reduce(map, reduce, :out => output_collection).find()
+ ratings.collection.map_reduce(map, reduce, :out => output_collection).find().first()['value']
end
def rated?
@@ -43,7 +42,8 @@ person = MongoRates::Models::PersonRating.find_person(person)
return nil unless person
- ratings.first(:person_rating_id => person.id)
+ rating = ratings.first(:person_rating_id => person.id)
+ rating.value if rating
end
end
end
|
Fix a few error in average_rating and persons_rating
|
diff --git a/lib/swagger/docs/methods.rb b/lib/swagger/docs/methods.rb
index abc1234..def5678 100644
--- a/lib/swagger/docs/methods.rb
+++ b/lib/swagger/docs/methods.rb
@@ -16,7 +16,7 @@ end
def swagger_models
- @swagger_model_dsls
+ @swagger_model_dsls ||= {}
end
def swagger_config
|
Fix bug with not having any models declared
|
diff --git a/lib/brightbox-cli/commands/cloudips-update.rb b/lib/brightbox-cli/commands/cloudips-update.rb
index abc1234..def5678 100644
--- a/lib/brightbox-cli/commands/cloudips-update.rb
+++ b/lib/brightbox-cli/commands/cloudips-update.rb
@@ -5,7 +5,7 @@ c.desc "Set reverse DNS for this cloud ip"
c.flag [:r, "reverse-dns"]
- c.desc "Delete the reverse dns for this cloud ip"
+ c.desc "Delete the reverse DNS for this cloud ip"
c.switch ["delete-reverse-dns"]
c.action do |global_options,options,args|
@@ -13,7 +13,7 @@ raise "You must specify the cloud ip id as the first argument" unless cip_id =~ /^cip-/
if options[:r] && options[:r] != "" && options[:"delete-reverse-dns"]
- raise "You must either specify a reverse dns record or --delete-reverse-dns"
+ raise "You must either specify a reverse DNS record or --delete-reverse-dns"
end
cip = CloudIP.find cip_id
|
Make reverse DNS wording uninform
|
diff --git a/lib/netsuite/records/sales_order_item_list.rb b/lib/netsuite/records/sales_order_item_list.rb
index abc1234..def5678 100644
--- a/lib/netsuite/records/sales_order_item_list.rb
+++ b/lib/netsuite/records/sales_order_item_list.rb
@@ -9,6 +9,15 @@ items << SalesOrderItem.new(attributes[:item])
when Array
attributes[:item].each { |item| items << SalesOrderItem.new(item) }
+ end
+ end
+
+ def item=(items)
+ case items
+ when Hash
+ self.items << SalesOrderItem.new(items)
+ when Array
+ items.each { |item| self.items << SalesOrderItem.new(item) }
end
end
|
Allow adding items in SalesOrder
following same pattern as Invoice
|
diff --git a/lib/wakame/monitor/agent.rb b/lib/wakame/monitor/agent.rb
index abc1234..def5678 100644
--- a/lib/wakame/monitor/agent.rb
+++ b/lib/wakame/monitor/agent.rb
@@ -23,12 +23,7 @@
def check
- if Wakame.environment == :EC2
- require 'wakame/vm_manipulator'
- attrs = Wakame::VmManipulator::EC2::MetadataService.fetch_local_attrs
- else
- attrs = Wakame::VmManipulator::StandAlone.fetch_local_attrs
- end
+ attrs = Wakame::VmManipulator.create.fetch_local_attrs
res = {:attrs=>attrs, :monitors=>[], :actors=>[], :services=>{}}
EM.barrier {
|
Simplify the code on feching the vm attributes.
|
diff --git a/app/helpers/versions_helper.rb b/app/helpers/versions_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/versions_helper.rb
+++ b/app/helpers/versions_helper.rb
@@ -6,7 +6,10 @@ end
def friendly_changeset_title(version)
- if version.changeset['http_status']
+
+ if version.changeset['id']
+ "Mapping created"
+ elsif version.changeset['http_status']
if version.changeset['http_status'][0] == '410'
"Archive → Redirect"
else
|
Include created message in version history
|
diff --git a/app/models/server/rotations.rb b/app/models/server/rotations.rb
index abc1234..def5678 100644
--- a/app/models/server/rotations.rb
+++ b/app/models/server/rotations.rb
@@ -4,13 +4,9 @@ include RequestCacheable
included do
- # {
- # rotation_name => {
- # "maps" => [map_name, map_name, ...],
- # "next" => map_index
- # }
- # }
- field :rotations, type: Hash
+ field :rotations, type: Array, default: [].freeze
+ attr_accessible :rotations
+ api_property :rotations
field :rotation_file, type: String # relative to rotations repo root
|
Store rotation data in the database
|
diff --git a/db/migrate/20090330195815_add_single_access_token_to_users.rb b/db/migrate/20090330195815_add_single_access_token_to_users.rb
index abc1234..def5678 100644
--- a/db/migrate/20090330195815_add_single_access_token_to_users.rb
+++ b/db/migrate/20090330195815_add_single_access_token_to_users.rb
@@ -1,6 +1,12 @@ class AddSingleAccessTokenToUsers < ActiveRecord::Migration
+
+ class User < ActiveRecord::Base; acts_as_authentic; end;
+
def self.up
add_column :users, :single_access_token, :string, :null => false
+ User.all.each do |user|
+ user.reset_single_access_token!
+ end
end
def self.down
|
Create a single_access_token for all existing users
|
diff --git a/lib/heroku/deploy/tasks/unsafe_migration.rb b/lib/heroku/deploy/tasks/unsafe_migration.rb
index abc1234..def5678 100644
--- a/lib/heroku/deploy/tasks/unsafe_migration.rb
+++ b/lib/heroku/deploy/tasks/unsafe_migration.rb
@@ -3,6 +3,14 @@ include Heroku::Deploy::UI
def before_deploy
+ task "Turn off preboot if its enabled" do
+ @preboot = app.feature_enabled? :preboot
+
+ if @preboot
+ app.disable_feature :preboot
+ end
+ end
+
task "Turning on maintenance mode" do
app.enable_maintenance
end
@@ -18,6 +26,12 @@ task "Turning off maintenance mode" do
app.disable_maintenance
end
+
+ if @preboot
+ task "Enabling preboot again" do
+ app.enable_feature :preboot
+ end
+ end
end
end
end
|
Revert "I don't care about preboot anymore"
This reverts commit 314010546a7f07ea6c81710400b0e4f59289aa26.
|
diff --git a/lib/kmz_compressor/controller_extensions.rb b/lib/kmz_compressor/controller_extensions.rb
index abc1234..def5678 100644
--- a/lib/kmz_compressor/controller_extensions.rb
+++ b/lib/kmz_compressor/controller_extensions.rb
@@ -5,7 +5,7 @@
module ClassMethods
def defer_until_kmz_cached(*actions)
- around_filter :render_202_while_caching, :only => actions
+ around_action :render_202_while_caching, :only => actions
end
end
|
Switch from around_filter to around_action
|
diff --git a/lib/travis/build/appliances/update_glibc.rb b/lib/travis/build/appliances/update_glibc.rb
index abc1234..def5678 100644
--- a/lib/travis/build/appliances/update_glibc.rb
+++ b/lib/travis/build/appliances/update_glibc.rb
@@ -6,6 +6,7 @@ class UpdateGlibc < Base
def apply
sh.fold "fix.CVE-2015-7547" do
+ fix_gce_apt_src
sh.export 'DEBIAN_FRONTEND', 'noninteractive'
sh.cmd <<-EOF
if [ ! $(uname|grep Darwin) ]; then
@@ -15,6 +16,12 @@ EOF
end
end
+
+ def fix_gce_apt_src
+ sh.if "`hostname` == testing-gce-*" do
+ sh.cmd "sudo sed -i 's%us-central1.gce.archive.ubuntu.com/ubuntu%us.archive.ubuntu.com/ubuntu%' /etc/apt/sources.list"
+ end
+ end
end
end
end
|
Update APT source for builds on GCE
|
diff --git a/app/mailers/import_mailer.rb b/app/mailers/import_mailer.rb
index abc1234..def5678 100644
--- a/app/mailers/import_mailer.rb
+++ b/app/mailers/import_mailer.rb
@@ -3,11 +3,34 @@
def notify_fail(err_msg)
@err_msg = err_msg
- mail(to: Settings.mail_tech_support, subject: 'API import failed')
+ mail(to: Settings.mail_tech_support, subject: prefix('API import failed'))
end
def notify_success(report)
@report = report
- mail(to: Settings.mail_tech_support, subject: 'API import succeeded')
+ mail(to: Settings.mail_tech_support, subject: prefix('API import succeeded'))
+ end
+
+ private
+
+ def prefix(subject)
+ "[#{app_env}][#{app_version}] #{subject}"
+ end
+
+ def app_version
+ ENV.fetch('APP_VERSION', 'version-unknown')
+ end
+
+ def app_env
+ case ENV['SENDING_HOST']
+ when 'trackparliamentaryquestions.service.gov.uk'
+ 'production'
+ when 'staging.pq.dsd.io'
+ 'staging'
+ when 'dev.pq.dsd.io'
+ 'dev'
+ else
+ 'env-unknown'
+ end
end
end
|
Add app version and environment info to import mailers
|
diff --git a/lib/specinfra/backend/powershell/command.rb b/lib/specinfra/backend/powershell/command.rb
index abc1234..def5678 100644
--- a/lib/specinfra/backend/powershell/command.rb
+++ b/lib/specinfra/backend/powershell/command.rb
@@ -22,7 +22,7 @@ when Regexp
target.source
else
- target.to_s.gsub '/', ''
+ target.to_s.gsub '(^\/|\/$)', ''
end
end
|
Allow forward slashes within PS literal
|
diff --git a/app/models/renalware/letters.rb b/app/models/renalware/letters.rb
index abc1234..def5678 100644
--- a/app/models/renalware/letters.rb
+++ b/app/models/renalware/letters.rb
@@ -1,7 +1,13 @@ module Renalware
module Letters
+ module_function
+
def self.table_name_prefix
"letter_"
end
+
+ def cast_patient(patient)
+ ActiveType.cast(patient, ::Renalware::Letters::Patient)
+ end
end
end
|
Use module_function to cast the module patient
|
diff --git a/app/uploaders/photo_uploader.rb b/app/uploaders/photo_uploader.rb
index abc1234..def5678 100644
--- a/app/uploaders/photo_uploader.rb
+++ b/app/uploaders/photo_uploader.rb
@@ -35,7 +35,7 @@
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
- # def extension_white_list
- # %w(jpg jpeg gif png)
- # end
+ def extension_white_list
+ %w(jpg jpeg gif png)
+ end
end
|
Revert "Remove extension whitelist, as further heroku debugging effort."
This reverts commit e40d89c3602292230ec43c2b2af29f8d1a70c9cc.
|
diff --git a/app/workers/publisher_update.rb b/app/workers/publisher_update.rb
index abc1234..def5678 100644
--- a/app/workers/publisher_update.rb
+++ b/app/workers/publisher_update.rb
@@ -28,6 +28,7 @@ e.title = feature.title
e.description = feature.description
e.geom = feature.geometry
+ e.properties.merge!(feature.properties)
end
end
|
Store geojson properties in event records
|
diff --git a/app/concerns/couriers/fusionable.rb b/app/concerns/couriers/fusionable.rb
index abc1234..def5678 100644
--- a/app/concerns/couriers/fusionable.rb
+++ b/app/concerns/couriers/fusionable.rb
@@ -37,6 +37,7 @@ notify "Adding to Fusion Tables", photo.key
table.select("ROWID", "WHERE name='#{photo.key}'").map(&:values).map(&:first).map { |id| table.delete id }
table.insert [photo.to_fusion]
+ sleep 0.6 # 5 queries per second
rescue => e
notify "Fusion Tables failed", id
end
|
Allow up to 5 queries per second
|
diff --git a/app/controllers/meals_controller.rb b/app/controllers/meals_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/meals_controller.rb
+++ b/app/controllers/meals_controller.rb
@@ -21,4 +21,8 @@ select_or_create_permit(:meal, :location_attributes, LocationsController.param_names)
)
end
+
+ def new_obj_initialize
+ @obj.meal_time = DateTime.now
+ end
end
|
Initialize meal time to current time
|
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb
index abc1234..def5678 100644
--- a/app/controllers/posts_controller.rb
+++ b/app/controllers/posts_controller.rb
@@ -5,7 +5,7 @@ @post = current_site.posts.published.find_by!(public_id: params[:id])
@pages =
- if params[:all]
+ if current_site.view_all? && params[:all]
@post.pages.page(1).per(@post.pages.size)
else
@post.pages.page(params[:page]).per(1)
|
Disable all param on controller
ref: #472
|
diff --git a/app/models/spree/order_decorator.rb b/app/models/spree/order_decorator.rb
index abc1234..def5678 100644
--- a/app/models/spree/order_decorator.rb
+++ b/app/models/spree/order_decorator.rb
@@ -11,25 +11,23 @@
return unless promotion_code
- joins(:adjustments)
- .merge(Spree::Adjustment.eligible)
- .joins("INNER JOIN #{orders_promotions_table} ON #{orders_promotions_table}.order_id = spree_adjustments.adjustable_id")
- .where("#{orders_promotions_table}.promotion_code_id = ?", promotion_code.id)
+ promo_actions_ids = promotion_code.promotion.actions.pluck('spree_promotion_actions.id')
+ orders_ids = Spree::Adjustment
+ .eligible
+ .where(source_id: promo_actions_ids)
+ .pluck(:order_id)
+
+ where(id: orders_ids)
end
# List all codes used in this order
def codes_used
# Promotion actions applied in this order
- promo_actions_ids = adjustments.eligible.pluck(:source_id)
+ promo_actions_ids = Spree::Adjustment.eligible.where(order_id: id).pluck(:source_id)
+ promos_ids = Spree::Promotion.joins(:promotion_actions).where('spree_promotion_actions.id = (?)', promo_actions_ids).pluck('spree_promotions.id')
- # Promotion codes used (ids)
- promo_codes_used = Spree::OrdersPromotion
- .joins(:promotion => :promotion_actions)
- .where('spree_promotion_actions.id IN (?) AND spree_orders_promotions.order_id = ?', promo_actions_ids, id)
- .pluck(:promotion_code_id)
-
- # List of codes used
- Spree::PromotionCode.where(id: promo_codes_used).pluck(:code).join(', ')
+ codes_used_ids = Spree::OrdersPromotion.where(promotion_id: promos_ids, order_id: id).pluck(:promotion_code_id)
+ Spree::PromotionCode.where(id: codes_used_ids).pluck(:code).join(', ')
end
def self.orders_promotions_table
|
Fix query used to filter orders by code used
|
diff --git a/jredshift.gemspec b/jredshift.gemspec
index abc1234..def5678 100644
--- a/jredshift.gemspec
+++ b/jredshift.gemspec
@@ -23,5 +23,5 @@
spec.add_dependency 'jdbc-postgres', '~> 9.3'
spec.add_development_dependency 'bundler', '~> 1.6'
- spec.add_development_dependency 'rake', '~> 0'
+ spec.add_development_dependency 'rake', '~> 10'
end
|
Set explicit version for rake
|
diff --git a/test/active_waiter/configuration_test.rb b/test/active_waiter/configuration_test.rb
index abc1234..def5678 100644
--- a/test/active_waiter/configuration_test.rb
+++ b/test/active_waiter/configuration_test.rb
@@ -1,7 +1,7 @@ require 'test_helper'
class ConfigurationTest < Minitest::Test
- def teardown
+ def setup
ActiveWaiter.configuration = nil
end
@@ -15,5 +15,6 @@ end
assert_equal "layouts/application", ActiveWaiter.configuration.layout
+ ActiveWaiter.configuration = nil
end
end
|
Fix sporadic build break when affected by leftover config from other tests
|
diff --git a/doberman.gemspec b/doberman.gemspec
index abc1234..def5678 100644
--- a/doberman.gemspec
+++ b/doberman.gemspec
@@ -21,5 +21,4 @@ spec.add_development_dependency "bundler", "~> 1.5"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec"
- spec.add_development_dependency "debugger"
end
|
Remove debugger gem from dependencies.
|
diff --git a/app/interactors/fetch_exams.rb b/app/interactors/fetch_exams.rb
index abc1234..def5678 100644
--- a/app/interactors/fetch_exams.rb
+++ b/app/interactors/fetch_exams.rb
@@ -8,16 +8,13 @@ client = kosapi_client(faculty_semester)
@exams = client.exams.where("course.faculty==#{faculty_semester.faculty};semester==#{faculty_semester.code}").limit(limit)
@exams.auto_paginate = paginate
- @exams.each { |exam| extract_room(exam) }
+ @exams.lazy.map(&:room).reject(&:nil?).each do |room|
+ @rooms[room.link_id] ||= room
+ end
end
def results
{ exams: @exams, faculty_semester: @faculty_semester, kosapi_rooms: @rooms.values }
end
- def extract_room(exam)
- room = exam.room
- @rooms[room.link_id] ||= room if room
- end
-
end
|
Refactor extracting of rooms in FetchExams to be less procedural
|
diff --git a/test/lib/catissue/domain/address_test.rb b/test/lib/catissue/domain/address_test.rb
index abc1234..def5678 100644
--- a/test/lib/catissue/domain/address_test.rb
+++ b/test/lib/catissue/domain/address_test.rb
@@ -1,4 +1,4 @@-require File.join(File.dirname(__FILE__), '..', 'test_case')
+require File.dirname(__FILE__) + '/../helpers/test_case'
require 'caruby/util/uniquifier'
class AddressTest < Test::Unit::TestCase
@@ -21,12 +21,13 @@ end
def test_save
- assert_raises(CaRuby::DatabaseError, "Address save without owner incorrectly saved") { @addr.save }
- @addr.user = @user
+ # Create the address.
verify_save(@addr)
- expected = @addr.street = "#{Uniquifier.qualifier} Elm"
+ # Modify the address.
+ expected = @addr.street = "#{Uniquifier.qualifier} Elm St."
verify_save(@addr)
+ # Find the address.
fetched = @addr.copy(:identifier).find
assert_equal(expected, fetched.street, "Address street not saved")
end
-end+end
|
Address does not reference the owner.
|
diff --git a/test/unit/webhookr/ostruct_utils_test.rb b/test/unit/webhookr/ostruct_utils_test.rb
index abc1234..def5678 100644
--- a/test/unit/webhookr/ostruct_utils_test.rb
+++ b/test/unit/webhookr/ostruct_utils_test.rb
@@ -10,22 +10,22 @@ end
test "should be an OpenStruct" do
- assert(@converted.is_a?(OpenStruct))
+ assert_instance_of(OpenStruct, @converted)
end
test "should have a nested OpenStruct" do
- assert(@converted.a.is_a?(OpenStruct))
+ assert_instance_of(OpenStruct, @converted.a)
end
test "should have a nested nested OpenStruct" do
- assert(@converted.a.b.is_a?(OpenStruct))
+ assert_instance_of(OpenStruct, @converted.a.b)
end
test "should have a nested nested nested value of 1" do
- assert(@converted.a.b.c == 1)
+ assert_equal(1, @converted.a.b.c)
end
test "should replace a nested hash in an array" do
- assert(@converted.a1.first.b1.c1 == 1)
+ assert_equal(1, @converted.a1.first.b1.c1)
end
end
|
Use specific assertions instead of `assert`.
|
diff --git a/examples/import_users.rb b/examples/import_users.rb
index abc1234..def5678 100644
--- a/examples/import_users.rb
+++ b/examples/import_users.rb
@@ -0,0 +1,51 @@+require 'bundler/setup'
+require 'honey_format'
+
+csv_string = <<~CSV
+Email,Name,Age,Country
+john@example.com,John Doe,42,Sweden
+jane@example.com,Jane Doe,42,Denmark
+CSV
+
+puts '== EXAMPLE: CSV output with filtered columns and rows =='
+puts
+
+class User
+ def self.create!(attributes)
+ puts "Creating user with attributes: #{attributes}"
+ end
+end
+
+# Map country names to country code
+country_coder = lambda do |value|
+ {
+ 'Sweden' => 'SE',
+ 'Denmark' => 'DK',
+ # ...
+ }.fetch(value, value)
+end
+
+HoneyFormat.configure do |config|
+ # Register the country coder
+ config.converter.register :country_code, country_coder
+end
+
+# Convert the country header column to country_code
+header_converter = lambda do |value, index|
+ # First use the default converter
+ value = HoneyFormat.header_converter.call(value, index)
+ value == :country ? :country_code : value
+end
+
+# convert column values
+type_map = {
+ age: :integer,
+ country_code: :country_code,
+}
+
+csv = HoneyFormat::CSV.new(
+ csv_string,
+ type_map: type_map,
+ header_converter: header_converter
+)
+csv.each_row { |user| User.create!(user.to_h) }
|
Add import users example to examples/
|
diff --git a/examples/rails/deploy.rb b/examples/rails/deploy.rb
index abc1234..def5678 100644
--- a/examples/rails/deploy.rb
+++ b/examples/rails/deploy.rb
@@ -1,5 +1,2 @@-set :application, "application"
-
-role :app, "yourhost.com"
-role :web, "yourhost.com"
-role :db, "yourhost.com", :primary => true
+set :user, 'root'
+role :app, 'yourhost.com', :primary => true
|
Reduce example capistrano configuration to minimum sprinkle requires
|
diff --git a/app/helpers/images_helper.rb b/app/helpers/images_helper.rb
index abc1234..def5678 100644
--- a/app/helpers/images_helper.rb
+++ b/app/helpers/images_helper.rb
@@ -5,7 +5,7 @@ if Paperclip::Attachment.default_options[:storage] == :filesystem
URI(request.url) + image.attachment.url(version)
else
- investment.image_url(version)
+ image.attachment.url(version)
end
end
|
Fix social share image URL with external storage
Co-Authored-By: Pierre Mesure <ff019a5748a52b5641624af88a54a2f0e46a9fb5@mesu.re>
|
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
@@ -9,7 +9,7 @@
def matches?(aggregate_root)
@events = aggregate_root.unpublished_events.to_a
- matcher.matches?(events) && matches_count(events, expected, count)
+ matcher.matches?(events) && matches_count?
end
def exactly(count)
@@ -32,7 +32,7 @@
private
- def matches_count(events, expected, count)
+ def matches_count?
return true unless count
raise NotSupported if expected.size > 1
|
Kill passing ivars as local vars
Issue: #215
|
diff --git a/app/mappers/drupal_mapper.rb b/app/mappers/drupal_mapper.rb
index abc1234..def5678 100644
--- a/app/mappers/drupal_mapper.rb
+++ b/app/mappers/drupal_mapper.rb
@@ -3,7 +3,7 @@ def self.parse(json)
json_map = fields.inject({}) do |agg, (k, v)|
agg[k] = v.inject(json) do |iterator, node|
- iterator[node]
+ iterator.fetch(node)
end
agg
end
|
Raise an exception if required fields are missing in the drupal node
|
diff --git a/app/models/address_record.rb b/app/models/address_record.rb
index abc1234..def5678 100644
--- a/app/models/address_record.rb
+++ b/app/models/address_record.rb
@@ -1,3 +1,5 @@+require "resolv"
+
class AddressRecord < Record
- validates :content, presence: true
+ validates :content, presence: true, format: {with: Resolv::IPv4::Regex}
end
|
Make sure addresses are valid IPs
|
diff --git a/app/models/storytime/blog.rb b/app/models/storytime/blog.rb
index abc1234..def5678 100644
--- a/app/models/storytime/blog.rb
+++ b/app/models/storytime/blog.rb
@@ -1,6 +1,6 @@ module Storytime
class Blog < Page
- has_many :posts
+ has_many :posts, dependent: :destroy
def self.seed(site, user)
blog = site.blogs.new
|
Add dependent: :destroy to Blog
|
diff --git a/test/helper.rb b/test/helper.rb
index abc1234..def5678 100644
--- a/test/helper.rb
+++ b/test/helper.rb
@@ -1,3 +1,4 @@+Encoding.default_external = 'UTF-8'
require 'simplecov'
SimpleCov.start do
add_filter '/test|deps/'
|
Set default_external to UTF-8 for GitLab CI
|
diff --git a/blinkbox-common_mapping.gemspec b/blinkbox-common_mapping.gemspec
index abc1234..def5678 100644
--- a/blinkbox-common_mapping.gemspec
+++ b/blinkbox-common_mapping.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_mapping"
|
Fix Travis using 1.9.3 to build gems
|
diff --git a/smart_polling.gemspec b/smart_polling.gemspec
index abc1234..def5678 100644
--- a/smart_polling.gemspec
+++ b/smart_polling.gemspec
@@ -8,8 +8,8 @@ spec.version = SmartPolling::VERSION
spec.authors = ["Mateus Del Bianco"]
spec.email = ["mateus@delbianco.net.br"]
- spec.summary = %q{SmartPolling is your favorite watchdog timer.}
- spec.description = %q{SmartPolling makes sure your code is still alive, barking out loud if there's silence for too long.}
+ spec.summary = %q{SmartPolling is the smartest way to poll something.}
+ spec.description = %q{SmartPolling keeps polling something, for a limited time, until it gets a response.}
spec.homepage = "https://github.com/mateusdelbianco/smart_polling"
spec.license = "MIT"
|
Update gemspec summary and description
|
diff --git a/lib/sippy_cup/runner.rb b/lib/sippy_cup/runner.rb
index abc1234..def5678 100644
--- a/lib/sippy_cup/runner.rb
+++ b/lib/sippy_cup/runner.rb
@@ -0,0 +1,37 @@+require 'yaml'
+
+module SippyCup
+ class Runner
+ def initialize(path)
+ @options = YAML.load_file File.expand_path(path)
+ end
+
+ def prepare_command
+ ['scenario', 'source', 'destination', 'max_concurrent', 'calls_per_second', 'number_of_calls'].each do |arg|
+ raise "Must provide #{arg}!" unless @options[arg]
+ end
+ command = "sudo sipp"
+ source_port = @options['source_port'] || '8836'
+ sip_user = @options['sip_user'] || '1'
+ command << " -i #{@options['source']} -p #{source_port} -sf #{File.expand_path @options['scenario']}"
+ command << " -l #{@options['max_concurrent']} -m #{@options['number_of_calls']} -r #{@options['calls_per_second']}"
+ command << " -s #{sip_user}"
+ if @options['stats_file']
+ stats_interval = @options['stats_interval'] || 10
+ command << " -trace_stats -stf #{@options['stats_file']} -fd #{stats_interval}"
+ end
+ command << " > /dev/null 2> &1" unless @options['full_sipp_output']
+ command
+ end
+
+ def run
+ command = prepare_command
+ p "Preparing to run SIPp command: #{command}"
+ result = system command
+ raise "SIPp failed! Try running the scenario with the full_sipp_output enabled for more information" unless result
+ p "Test completed successfully!"
+ p "Statistics logged at #{File.expand_path @options['stats_file']}" if @options['stats_file']
+ end
+
+ end
+end
|
Add a Runner class to SippyCup
|
diff --git a/test/unit/spec/spec_helper.rb b/test/unit/spec/spec_helper.rb
index abc1234..def5678 100644
--- a/test/unit/spec/spec_helper.rb
+++ b/test/unit/spec/spec_helper.rb
@@ -2,7 +2,7 @@ require 'chefspec/server'
require 'chefspec/berkshelf'
-at_exit { ChefSpec::Coverage.start! }
+ChefSpec::Coverage.start!
RSpec.configure do |config|
config.platform = 'centos'
|
Remove 'at_exit' from coverage call, since in lib.
'start!' already wraps 'Coverage::report!' with at_exit in ChefSpec.
|
diff --git a/app/views/timer_view_cell.rb b/app/views/timer_view_cell.rb
index abc1234..def5678 100644
--- a/app/views/timer_view_cell.rb
+++ b/app/views/timer_view_cell.rb
@@ -6,11 +6,11 @@
@primaryLabel = UILabel.alloc.init
@primaryLabel.textAlignment = UITextAlignmentLeft
- @primaryLabel.font = UIFont.systemFontOfSize(14)
+ @primaryLabel.font = UIFont.systemFontOfSize(18)
@secondaryLabel = UILabel.alloc.init
- @secondaryLabel.textAlignment = UITextAlignmentLeft
- @secondaryLabel.font = UIFont.systemFontOfSize(8)
+ @secondaryLabel.textAlignment = UITextAlignmentRight
+ @secondaryLabel.font = UIFont.systemFontOfSize(14)
self.contentView.addSubview(@primaryLabel)
self.contentView.addSubview(@secondaryLabel)
@@ -24,7 +24,7 @@ contentRect = self.contentView.bounds
boundsX = contentRect.origin.x
- @primaryLabel.frame = CGRectMake(boundsX+70, 5, 200, 25)
- @secondaryLabel.frame = CGRectMake(boundsX+70, 30, 100, 15)
+ @primaryLabel.frame = CGRectMake(boundsX+10, 5, 200, 35)
+ @secondaryLabel.frame = CGRectMake(boundsX+10, 5, 300, 35)
end
end
|
Align text & change font sizes to be more readable
|
diff --git a/customerio.gemspec b/customerio.gemspec
index abc1234..def5678 100644
--- a/customerio.gemspec
+++ b/customerio.gemspec
@@ -22,4 +22,5 @@ gem.add_development_dependency('rspec')
gem.add_development_dependency('webmock')
gem.add_development_dependency('addressable', '~> 2.3.6')
+ gem.add_development_dependency('json')
end
|
Add JSON dev dependency for webmock
webmock should require this itself, but doesn't. Sigh.
|
diff --git a/db/migrate/20190626175626_add_group_creation_level_to_namespaces.rb b/db/migrate/20190626175626_add_group_creation_level_to_namespaces.rb
index abc1234..def5678 100644
--- a/db/migrate/20190626175626_add_group_creation_level_to_namespaces.rb
+++ b/db/migrate/20190626175626_add_group_creation_level_to_namespaces.rb
@@ -0,0 +1,20 @@+# frozen_string_literal: true
+
+class AddGroupCreationLevelToNamespaces < ActiveRecord::Migration[5.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ disable_ddl_transaction!
+
+ def up
+ unless column_exists?(:namespaces, :subgroup_creation_level)
+ add_column_with_default(:namespaces, :subgroup_creation_level, :integer, default: 0)
+ end
+ end
+
+ def down
+ if column_exists?(:namespaces, :subgroup_creation_level)
+ remove_column(:namespaces, :subgroup_creation_level)
+ end
+ end
+end
|
Add a subgroup_creation_level column to the namespaces table
|
diff --git a/gh.gemspec b/gh.gemspec
index abc1234..def5678 100644
--- a/gh.gemspec
+++ b/gh.gemspec
@@ -20,11 +20,7 @@ s.add_runtime_dependency 'faraday', '~> 0.8'
s.add_runtime_dependency 'backports'
s.add_runtime_dependency 'multi_json', '~> 1.0'
- if RUBY_VERSION < '2.0'
- s.add_runtime_dependency 'addressable', '~> 2.4.0'
- else
- s.add_runtime_dependency 'addressable'
- end
- s.add_runtime_dependency 'net-http-persistent', '>= 2.7'
+ s.add_runtime_dependency 'addressable', '~> 2.4.0'
+ s.add_runtime_dependency 'net-http-persistent', '~> 2.9'
s.add_runtime_dependency 'net-http-pipeline'
end
|
Fix gems to older version
I wanted to find a solution to this that would allow newer Rubies
to upgrade beyond these older gem versions, but I've already
sunk too much time here.
See https://github.com/rubygems/rubygems/issues/722
|
diff --git a/metadata.rb b/metadata.rb
index abc1234..def5678 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -8,7 +8,7 @@
depends 'xml'
-supports 'fedora', '>= 21'
+supports 'fedora', '>= 21.0'
supports 'centos', '>= 7.0'
supports 'rhel', '>= 7.0'
supports 'ubuntu', '>= 14.10'
|
Switch supports fedora "21" to "21.0"
|
diff --git a/lib/hetchy.rb b/lib/hetchy.rb
index abc1234..def5678 100644
--- a/lib/hetchy.rb
+++ b/lib/hetchy.rb
@@ -6,17 +6,17 @@ :pool, # current pool data
:size # size of allocated pool
- # Available opts:
+ # Create a reservoir.
# @option opts [Integer] :size Size of reservoir
#
def initialize(opts={})
@count = 0
- @size = opts.fetch(:size, 1024)
+ @size = opts.fetch(:size, 1000)
@pool = Array.new(@size, 0)
@lock = Mutex.new
end
- # Add one or more values to the reservoir
+ # Add one or more values to the reservoir.
# @example
# reservoir << 1234
# reservoir << [2345,7891,2131]
@@ -24,6 +24,7 @@ def << (values)
Array(values).each do |value|
@lock.synchronize do
+ # sampling strategy is Vitter's algo R
if count < size
@pool[count] = value
else
|
Tweak comments; adjust default reservoir size.
|
diff --git a/config/initializers/bugsnag.rb b/config/initializers/bugsnag.rb
index abc1234..def5678 100644
--- a/config/initializers/bugsnag.rb
+++ b/config/initializers/bugsnag.rb
@@ -1,3 +1,3 @@ Bugsnag.configure do |config|
- config.api_key = ENV["RESPONSIVE_BUG_SNAG_KEY"] unless (ENV['MAS_ENVIRONMENT'] == 'qa')
+ config.api_key = ENV["RESPONSIVE_BUGSNAG_KEY"]
end
|
Remove env check as we can do this in puppet now
|
diff --git a/spec/shoes/sound_spec.rb b/spec/shoes/sound_spec.rb
index abc1234..def5678 100644
--- a/spec/shoes/sound_spec.rb
+++ b/spec/shoes/sound_spec.rb
@@ -1,4 +1,6 @@ require 'shoes/spec_helper'
+# To be removed when Sound is converted from module to class
+require 'white_shoes'
describe Shoes::Sound do
let(:gui_container) { double("gui container") }
|
Fix spec failure for seed 23311
|
diff --git a/lib/markdo/cli.rb b/lib/markdo/cli.rb
index abc1234..def5678 100644
--- a/lib/markdo/cli.rb
+++ b/lib/markdo/cli.rb
@@ -10,38 +10,12 @@
def run(command_name = 'help', *args)
command = case command_name
- when 'add'
- AddCommand
- when 'edit'
- EditCommand
- when 'forecast'
- ForecastCommand
- when 'ics'
- IcsCommand
- when 'inbox'
- InboxCommand
- when 'overdue'
- OverdueCommand
- when 'overview'
- OverviewCommand
- when 'process'
- ProcessCommand
- when 'query', 'q'
+ when 'q'
QueryCommand
- when 'star', 'starred'
+ when 'starred'
StarCommand
- when 'summary'
- SummaryCommand
- when 'tag'
- TagCommand
- when 'today'
- TodayCommand
- when 'tomorrow'
- TomorrowCommand
when '--version'
VersionCommand
- when 'week'
- WeekCommand
else
choose_command_class(command_name)
end
|
Refactor: Remove case/when covered by open/closed code
|
diff --git a/lib/plugins/wa.rb b/lib/plugins/wa.rb
index abc1234..def5678 100644
--- a/lib/plugins/wa.rb
+++ b/lib/plugins/wa.rb
@@ -11,8 +11,16 @@ input_array = text.split(/[[:space:]]/)
input = input_array.join(' ').downcase
response = Nokogiri::XML(open("http://api.wolframalpha.com/v2/query?input=#{URI.encode(input)}&appid=#{ENV['WA_ID']}"))
- interp = response.xpath('//plaintext').children[0]
- result = response.xpath('//plaintext').children[1]
+ interp = response.xpath('//plaintext').children[0].text
+ if interp.size > 75
+ interp.slice! 75..-1
+ interp += "..."
+ end
+ result = response.xpath('//plaintext').children[1].text
+ if result.size > 75
+ result.slice! 75..-1
+ result += "..."
+ end
m.reply "#{interp} => #{result}"
end
|
Cut bot response if length greater than 75 characters
|
diff --git a/lib/vim-flavor.rb b/lib/vim-flavor.rb
index abc1234..def5678 100644
--- a/lib/vim-flavor.rb
+++ b/lib/vim-flavor.rb
@@ -13,6 +13,7 @@ :ShellUtility,
:StringExtension,
:VERSION,
+ :Version,
:VersionConstraint,
].each do |name|
autoload name, "vim-flavor/#{name.to_s().downcase()}"
|
Add a missing autoload declaration
|
diff --git a/test/unit/spec/default_spec.rb b/test/unit/spec/default_spec.rb
index abc1234..def5678 100644
--- a/test/unit/spec/default_spec.rb
+++ b/test/unit/spec/default_spec.rb
@@ -3,12 +3,17 @@ require_relative 'spec_helper'
describe 'system::default' do
- before { stub_resources }
- describe 'ubuntu' do
- let(:chef_run) { ChefSpec::Runner.new.converge(described_recipe) }
+ let(:chef_run) { ChefSpec::SoloRunner.new.converge(described_recipe) }
- it 'writes some chefspec code' do
- pending 'todo'
- end
+ it 'includes the `update_package_list` recipe' do
+ expect(chef_run).to include_recipe('system::update_package_list')
+ end
+
+ it 'includes the `timezone` recipe' do
+ expect(chef_run).to include_recipe('system::timezone')
+ end
+
+ it 'includes the `hostname` recipe' do
+ expect(chef_run).to include_recipe('system::hostname')
end
end
|
Add some basic ChefSpec tests.
|
diff --git a/etd_model.gemspec b/etd_model.gemspec
index abc1234..def5678 100644
--- a/etd_model.gemspec
+++ b/etd_model.gemspec
@@ -11,7 +11,7 @@ s.summary = 'ETD content model used by the SULAIR Digital Library'
s.description = 'Contains classes that define the Fedora content model for electronic theses and dissertations.'
- s.add_dependency 'dor-services', '~> 5.26'
+ s.add_dependency 'dor-services', '~> 6.0'
s.add_dependency 'active-fedora', '~> 8.4'
s.add_development_dependency 'coveralls'
|
Update dor-services dependency to ~> 6.0
|
diff --git a/spec/CheckfrontAPI_spec.rb b/spec/CheckfrontAPI_spec.rb
index abc1234..def5678 100644
--- a/spec/CheckfrontAPI_spec.rb
+++ b/spec/CheckfrontAPI_spec.rb
@@ -8,9 +8,9 @@ it "can reach the server" do
expect(CheckfrontAPI::Client::test_connection).not_to be nil
end
-
- xit "can authenticate" do
-
+
+ it "can reach /account with basic auth" do
+ expect(CheckfrontAPI::Client::basic_auth).to include "OK"
end
-
+
end
|
Test accessing /account with basic auth
|
diff --git a/spec/factories/sections.rb b/spec/factories/sections.rb
index abc1234..def5678 100644
--- a/spec/factories/sections.rb
+++ b/spec/factories/sections.rb
@@ -2,6 +2,6 @@
FactoryGirl.define do
factory :section do
- name { Faker::Lorem.word }
+ sequence(:name) { |n| "Section #{n}" }
end
end
|
Fix failing test by enforcing unique section names
|
diff --git a/spec/how_is/integration.rb b/spec/how_is/integration.rb
index abc1234..def5678 100644
--- a/spec/how_is/integration.rb
+++ b/spec/how_is/integration.rb
@@ -0,0 +1,29 @@+require 'spec_helper'
+
+HOW_IS_EXE = File.expand_path('../../exe/how_is', __dir__)
+
+describe 'Integration Tests' do
+ context '--help and -h flags' do
+ it 'outputs usage information' do
+ %w[--help -h].each do |flag|
+ stub_const("ARGV", [flag])
+
+ expect {
+ load HOW_IS_EXE
+ }.to output(/Usage: how_is /).to_stdout
+ end
+ end
+ end
+
+ context '--version and -v flags' do
+ it 'outputs the version number' do
+ %w[--version -v].each do |flag|
+ stub_const("ARGV", [flag])
+
+ expect {
+ load HOW_IS_EXE
+ }.to output("#{HowIs::VERSION}\n").to_stdout
+ end
+ end
+ end
+end
|
Add tests for --help, -h, --version, and -v.
|
diff --git a/recipes/default.rb b/recipes/default.rb
index abc1234..def5678 100644
--- a/recipes/default.rb
+++ b/recipes/default.rb
@@ -27,5 +27,5 @@ source node[:influxdb][:source]
checksum node[:influxdb][:versions][arch][ver]
config node[:influxdb][:config]
- action [:create, :start]
+ action [:create]
end
|
Maintain BC, do not start the service
|
diff --git a/recipes/default.rb b/recipes/default.rb
index abc1234..def5678 100644
--- a/recipes/default.rb
+++ b/recipes/default.rb
@@ -22,6 +22,7 @@
package "sqlite3"
package "sqlite3-doc"
+ package "libsqlite3-dev"
when "rhel", "fedora"
|
Include SQLite 3 development files on debian platforms
|
diff --git a/spec/transport/udp_spec.rb b/spec/transport/udp_spec.rb
index abc1234..def5678 100644
--- a/spec/transport/udp_spec.rb
+++ b/spec/transport/udp_spec.rb
@@ -1,39 +1,42 @@ require 'spec_helper'
-describe LIFX::Transport::UDP, integration: true do
- subject(:udp) { LIFX::Transport::UDP.new(host, port) }
+module LIFX
+ describe Transport::UDP, integration: true do
+ subject(:udp) { Transport::UDP.new(host, port) }
- let(:host) { 'localhost' }
- let(:message) { double }
- let(:port) { 45_828 }
+ let(:host) { 'localhost' }
+ let(:message) { double }
+ let(:port) { 45_828 }
- describe '#write' do
- let(:payload) { double }
+ describe '#write' do
+ let(:payload) { double }
- it 'writes a Message to specified host' do
- expect(message).to receive(:pack).and_return(payload)
- expect_any_instance_of(UDPSocket).to receive(:send)
- .with(payload, 0, host, port)
- udp.write(message)
+ it 'writes a Message to specified host' do
+ expect(message).to receive(:pack).and_return(payload)
+ expect_any_instance_of(UDPSocket).to receive(:send)
+ .with(payload, 0, host, port)
+ udp.write(message)
+ end
end
- end
- describe '#listen' do
- let(:raw_message) { 'some binary data' }
- let(:socket) { UDPSocket.new }
+ describe '#listen' do
+ let(:raw_message) { 'some binary data' }
+ let(:socket) { UDPSocket.new }
+ let(:messages) { [] }
+ before do
+ udp.add_observer(self) do |message: nil, ip: nil, transport: nil|
+ messages << message
+ end
+ udp.listen
+ end
- it 'listens to the specified socket data, unpacks it and notifies observers' do
- messages = []
- udp.add_observer(self) do |message: nil, ip: nil, transport: nil|
- messages << message
+ it 'listens to the specified socket data, unpacks it and notifies observers' do
+ expect(Message).to receive(:unpack)
+ .with(raw_message)
+ .and_return(message)
+ socket.send(raw_message, 0, host, port)
+ wait { expect(messages).to include(message) }
end
- udp.listen
-
- expect(LIFX::Message).to receive(:unpack)
- .with(raw_message)
- .and_return(message)
- socket.send(raw_message, 0, host, port)
- wait { expect(messages).to include(message) }
end
end
end
|
Use namespaces in UDP spec
|
diff --git a/fugit.gemspec b/fugit.gemspec
index abc1234..def5678 100644
--- a/fugit.gemspec
+++ b/fugit.gemspec
@@ -18,6 +18,10 @@ Time tools for flor and the floraison project. Cron parsing and occurrence computing. Timestamps and more.
}.strip
+ s.metadata = {
+ 'changelog_uri' => s.homepage + '/blob/master/CHANGELOG.md'
+ }
+
#s.files = `git ls-files`.split("\n")
s.files = Dir[
'README.{md,txt}',
|
Add Rubygems link to changelog
|
diff --git a/scss_lint.gemspec b/scss_lint.gemspec
index abc1234..def5678 100644
--- a/scss_lint.gemspec
+++ b/scss_lint.gemspec
@@ -25,7 +25,7 @@
s.required_ruby_version = '>= 1.9.3'
- s.add_dependency 'rake', '>= 0.9', '< 11'
+ s.add_dependency 'rake', '>= 0.9', '< 12'
s.add_dependency 'sass', '~> 3.4.15'
s.add_development_dependency 'rspec', '~> 3.4.0'
|
Update dependencies to allow Rake 11
Resolves #756
|
diff --git a/config/schedule.rb b/config/schedule.rb
index abc1234..def5678 100644
--- a/config/schedule.rb
+++ b/config/schedule.rb
@@ -2,7 +2,7 @@
set :output, File.join(File.expand_path(File.dirname(__FILE__)), "log", "cron_log.log")
-job_type :rake, "cd :path && RAILS_ENV=:environment /home/rails/.rvm/bin/rake :task :output"
+job_type :rake, "cd :path && RAILS_ENV=:environment bundle exec rake :task :output"
job_type :find_command, "cd :path && :task :output"
# Sync with OSM but not between 1:59 and 3:00 o'clock
|
Handle rake tasks in cron jobs with bundle exec.
|
diff --git a/app/validators/not_a_national_archives_url_validator.rb b/app/validators/not_a_national_archives_url_validator.rb
index abc1234..def5678 100644
--- a/app/validators/not_a_national_archives_url_validator.rb
+++ b/app/validators/not_a_national_archives_url_validator.rb
@@ -1,9 +1,14 @@ class NotANationalArchivesURLValidator < ActiveModel::EachValidator
+ NATIONAL_ARCHIVES_HOST = 'webarchive.nationalarchives.gov.uk'
+
def validate_each(record, attribute, value)
return if value.blank?
- if value.include?('http://webarchive.nationalarchives.gov.uk')
- message = (options[:message])
- record.errors.add(attribute, message)
+ valid_url = begin
+ uri = Addressable::URI.parse(value)
+ uri.host != NATIONAL_ARCHIVES_HOST
+ rescue Addressable::URI::InvalidURIError
+ false
end
- end
+ record.errors.add(attribute, options[:message]) unless valid_url
+ end
end
|
Make the not-TNA validator check a parsed URL's host, not just a string
- This makes it consistent with how NationalArchivesURLValidator checks
for a TNA host.
|
diff --git a/examples/tree.rb b/examples/tree.rb
index abc1234..def5678 100644
--- a/examples/tree.rb
+++ b/examples/tree.rb
@@ -1,6 +1,6 @@ require './lib/psd'
-psd = PSD.new('/Users/ryanlefevre/LayerVault/Turtleworks/Conversation.psd')
+psd = PSD.new('examples/images/example.psd')
psd.parse!
pp psd.tree.to_hash
|
Change back to example PSD
|
diff --git a/calculators/cha2ds2/cha2ds2.rb b/calculators/cha2ds2/cha2ds2.rb
index abc1234..def5678 100644
--- a/calculators/cha2ds2/cha2ds2.rb
+++ b/calculators/cha2ds2/cha2ds2.rb
@@ -1,34 +1,22 @@-def get_bool(name)
- value = send "field_#{name}"
-
- begin
- value.to_s.to_bool
- rescue ArgumentError
- raise InvalidRequestError, "#{name} must be a boolean (true/false)"
- end
-end
-
name :cha2ds2
+require_helpers :get_field_as_integer, :get_field_as_sex, :get_field_as_bool
execute do
- raise FieldError.new("age", "age must be a number") if !field_age.is_float?
- raise FieldError.new("sex", "sex must be 'M' or 'F'") if !(field_sex.upcase == "M" || field_age.upcase == "F")
+ age = get_field_as_integer :age
+ sex = get_field_as_sex :sex
- congestive_heart_failure_history = get_bool("congestive_heart_failure_history")
- hypertension_history = get_bool("hypertension_history")
- stroke_history = get_bool("stroke_history")
- vascular_disease_history = get_bool("vascular_disease_history")
- diabetes = get_bool("diabetes")
-
- age = field_age.to_i
- sex = field_sex.to_s
+ congestive_heart_failure_history = get_field_as_bool :congestive_heart_failure_history
+ hypertension_history = get_field_as_bool :hypertension_history
+ stroke_history = get_field_as_bool :stroke_history
+ vascular_disease_history = get_field_as_bool :vascular_disease_history
+ diabetes = get_field_as_bool :diabetes
score = 0
score += 1 if (age > 65) && (age < 74)
score += 2 if (age >= 75)
- score += 1 if sex == "F"
+ score += 1 if sex == :female
score += 1 if congestive_heart_failure_history
score += 1 if hypertension_history
@@ -37,4 +25,4 @@ score += 1 if diabetes
{cha2ds2_vasc_score: score, units: "dimensionless"}
-end+end
|
Use type helper methods instead of custom method
|
diff --git a/lib/i18n/workflow.rb b/lib/i18n/workflow.rb
index abc1234..def5678 100644
--- a/lib/i18n/workflow.rb
+++ b/lib/i18n/workflow.rb
@@ -4,7 +4,6 @@ require "i18n/workflow/always_cascade"
require "i18n/workflow/exception_handler"
require "i18n/workflow/explicit_scope_key"
-require "i18n/workflow/translation_helper"
module I18n
module Workflow
|
Remove require to removed file
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.